private IReadOnlyDictionary <string, DslKeywordSchema> GetKeywordTableFromResource() { Dictionary <string, DslKeywordSchema> dict = GetBaseKeywordDictionary(); foreach (KeyValuePair <string, TypeBase> property in Resource.Properties) { dict[property.Key] = BicepKeywordSchemaBuilder.GetKeywordSchemaForBicepType(property.Value); } return(dict); }
private Dictionary <string, DslKeywordSchema> BuildCommonKeywordDictionary() { var dict = new Dictionary <string, DslKeywordSchema>(BicepType.BaseProperties.Count, StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair <string, ObjectProperty> property in BicepType.BaseProperties) { dict[property.Key] = BicepKeywordSchemaBuilder.GetKeywordSchemaForBicepType(property.Value.Type.Type); } return(dict); }
private IReadOnlyDictionary <string, DslKeywordSchema> BuildInnerKeywordDict() { Dictionary <string, DslKeywordSchema> dict = new Dictionary <string, DslKeywordSchema>(StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair <string, ObjectProperty> property in BicepType.Properties) { dict[property.Key] = BicepKeywordSchemaBuilder.GetKeywordSchemaForBicepType(property.Value.Type.Type); } return(dict); }
private IReadOnlyDictionary <string, DslKeywordSchema> BuildDiscriminatedKeywordDictionary(string discriminatorValue) { TypeBase discriminatedType = BicepType.Elements[discriminatorValue].Type; if (discriminatedType is not ObjectType objectType) { throw new ArgumentException($"Discriminated schema element has non-object type '{discriminatedType.GetType()}'"); } var dict = new Dictionary <string, DslKeywordSchema>(_commonKeywords.Value, StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair <string, ObjectProperty> discriminatedProperty in objectType.Properties) { dict[discriminatedProperty.Key] = BicepKeywordSchemaBuilder.GetKeywordSchemaForBicepType(discriminatedProperty.Value.Type.Type); } return(dict); }