public DiscriminatedObjectType(string name, TypeSymbolValidationFlags validationFlags, string discriminatorKey, IEnumerable <ITypeReference> unionMembers) : base(name) { var unionMembersByKey = new Dictionary <string, ITypeReference>(); var unionKeyTypes = new List <StringLiteralType>(); foreach (var member in unionMembers) { if (!(member.Type is NamedObjectType namedObject)) { throw new ArgumentException($"Invalid member of type {member.Type.GetType()}"); } if (!namedObject.Properties.TryGetValue(discriminatorKey, out var discriminatorProp)) { throw new ArgumentException("Missing discriminator field on member"); } if (!(discriminatorProp.TypeReference.Type is StringLiteralType stringLiteral)) { throw new ArgumentException($"Invalid discriminator field type {discriminatorProp.TypeReference.Type.Name} on member"); } unionMembersByKey.Add(stringLiteral.Name, member); unionKeyTypes.Add(stringLiteral); } this.UnionMembersByKey = unionMembersByKey.ToImmutableDictionary(); this.ValidationFlags = validationFlags; this.DiscriminatorKey = discriminatorKey; this.DiscriminatorKeysUnionType = UnionType.Create(unionKeyTypes); }
public ResourceType(ResourceTypeReference typeReference, ITypeReference body, TypeSymbolValidationFlags validationFlags) : base(typeReference.FormatName()) { TypeReference = typeReference; Body = body; ValidationFlags = validationFlags; }
public NamedObjectType(string name, TypeSymbolValidationFlags validationFlags, IEnumerable <TypeProperty> properties, ITypeReference?additionalPropertiesType, TypePropertyFlags additionalPropertiesFlags = TypePropertyFlags.None) : base(name) { this.ValidationFlags = validationFlags; this.Properties = properties.ToImmutableDictionary(property => property.Name, property => property, LanguageConstants.IdentifierComparer); this.AdditionalPropertiesType = additionalPropertiesType; this.AdditionalPropertiesFlags = additionalPropertiesFlags; }
public NamedObjectType(string name, TypeSymbolValidationFlags validationFlags, IEnumerable <TypeProperty> properties, ITypeReference?additionalPropertiesType, TypePropertyFlags additionalPropertiesFlags = TypePropertyFlags.None, IEnumerable <FunctionOverload>?functions = null) : base(name) { this.ValidationFlags = validationFlags; this.Properties = properties.ToImmutableDictionary(property => property.Name, LanguageConstants.IdentifierComparer); this.MethodResolver = FunctionResolver.Create(functions); this.AdditionalPropertiesType = additionalPropertiesType; this.AdditionalPropertiesFlags = additionalPropertiesFlags; }
public ObjectType(string name, TypeSymbolValidationFlags validationFlags, IEnumerable <TypeProperty> properties, ITypeReference?additionalPropertiesType, TypePropertyFlags additionalPropertiesFlags, Func <ObjectType, FunctionResolver> methodResolverBuilder) : base(name) { this.ValidationFlags = validationFlags; this.Properties = properties.ToImmutableDictionary(property => property.Name, LanguageConstants.IdentifierComparer); this.MethodResolver = methodResolverBuilder(this); this.AdditionalPropertiesType = additionalPropertiesType; this.AdditionalPropertiesFlags = additionalPropertiesFlags; }
public void Type_validation_runs_on_compilation_successfully(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) { var customTypes = new [] { CreateCustomResourceType("My.Rp/myType", "2020-01-01", validationFlags), }; var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { } } "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().BeEmpty(); }
public void Type_validation_narrowing_on_union_types(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) { var customTypes = new [] { CreateCustomResourceType("My.Rp/myType", "2020-01-01", validationFlags, new TypeProperty("stringOrInt", UnionType.Create(LanguageConstants.String, LanguageConstants.Int)), new TypeProperty("unspecifiedStringOrInt", UnionType.Create(LanguageConstants.String, LanguageConstants.Int)), new TypeProperty("abcOrDef", UnionType.Create(new StringLiteralType("abc"), new StringLiteralType("def"))), new TypeProperty("unspecifiedAbcOrDef", UnionType.Create(new StringLiteralType("abc"), new StringLiteralType("def")))), CreateCustomResourceType("My.Rp/myDependentType", "2020-01-01", validationFlags, new TypeProperty("stringOnly", LanguageConstants.String), new TypeProperty("abcOnly", new StringLiteralType("abc")), new TypeProperty("abcOnlyUnNarrowed", new StringLiteralType("abc")), new TypeProperty("stringOrIntUnNarrowed", UnionType.Create(LanguageConstants.String, LanguageConstants.Int)), new TypeProperty("abcOrDefUnNarrowed", UnionType.Create(new StringLiteralType("abc"), new StringLiteralType("def"), new StringLiteralType("ghi")))), }; var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { stringOrInt: 'abc' abcOrDef: 'abc' } } resource myDependentRes 'My.Rp/myDependentType@2020-01-01' = { name: 'steve' properties: { stringOnly: myRes.properties.stringOrInt // should be allowed abcOnly: myRes.properties.abcOrDef abcOnlyUnNarrowed: myRes.properties.unspecifiedAbcOrDef stringOrIntUnNarrowed: myRes.properties.unspecifiedStringOrInt abcOrDefUnNarrowed: myRes.properties.abcOrDef } } "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP036", expectedDiagnosticLevel).And.HaveMessage("The property \"abcOnlyUnNarrowed\" expected a value of type \"'abc'\" but the provided value is of type \"'abc' | 'def'\".") ); }
public DiscriminatedObjectType(string name, TypeSymbolValidationFlags validationFlags, string discriminatorKey, IEnumerable <ITypeReference> unionMembers) : base(name) { var unionMembersByKey = new Dictionary <string, ObjectType>(); var unionKeyTypes = new List <StringLiteralType>(); // start with required and we will aggregate in everything else var discriminatorPropertyFlags = TypePropertyFlags.Required; foreach (var member in unionMembers) { if (member.Type is not ObjectType objectType) { throw new ArgumentException($"Invalid member of type {member.Type.GetType()}"); } if (!objectType.Properties.TryGetValue(discriminatorKey, out var discriminatorProp)) { throw new ArgumentException("Missing discriminator field on member"); } discriminatorPropertyFlags |= discriminatorProp.Flags; if (discriminatorProp.TypeReference.Type is not StringLiteralType stringLiteral) { throw new ArgumentException($"Invalid discriminator field type {discriminatorProp.TypeReference.Type.Name} on member"); } unionMembersByKey.Add(stringLiteral.Name, objectType); unionKeyTypes.Add(stringLiteral); } this.UnionMembersByKey = unionMembersByKey.ToImmutableDictionary(); this.ValidationFlags = validationFlags; this.DiscriminatorKeysUnionType = TypeHelper.CreateTypeUnion(unionKeyTypes); this.DiscriminatorProperty = new TypeProperty(discriminatorKey, this.DiscriminatorKeysUnionType, discriminatorPropertyFlags); }
public void Type_validation_narrowing_on_discriminated_object_types(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) { var customTypes = new [] { CreateCustomResourceType("My.Rp/myType", "2020-01-01", validationFlags, new TypeProperty("myDisc1", new DiscriminatedObjectType("myDisc1", validationFlags, "discKey", new [] { new NamedObjectType("choiceA", validationFlags, new [] { new TypeProperty("discKey", new StringLiteralType("choiceA"), TypePropertyFlags.Required), new TypeProperty("valueA", LanguageConstants.String, TypePropertyFlags.Required), }, null), new NamedObjectType("choiceB", validationFlags, new [] { new TypeProperty("discKey", new StringLiteralType("choiceB"), TypePropertyFlags.Required), new TypeProperty("valueB", LanguageConstants.String, TypePropertyFlags.Required), }, null), } ))), }; { // missing discriminator key var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { myDisc1: { valueA: 'abc' } } } "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP078", expectedDiagnosticLevel).And.HaveMessage("The property \"discKey\" requires a value of type \"'choiceA' | 'choiceB'\", but none was supplied.") ); } { // incorrect discriminator key case var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { myDisc1: { DiscKey: 'choiceA' } } } "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP078", expectedDiagnosticLevel).And.HaveMessage("The property \"discKey\" requires a value of type \"'choiceA' | 'choiceB'\", but none was supplied."), x => x.Should().HaveCodeAndSeverity("BCP089", expectedDiagnosticLevel).And.HaveMessage("The property \"DiscKey\" is not allowed on objects of type \"'choiceA' | 'choiceB'\". Did you mean \"discKey\"?") ); } { // incorrect discriminator key var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { myDisc1: { discKey: 'foo' } } } "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP036", expectedDiagnosticLevel).And.HaveMessage("The property \"discKey\" expected a value of type \"'choiceA' | 'choiceB'\" but the provided value is of type \"'foo'\".") ); } { // incorrect discriminator key with suggestion var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { myDisc1: { discKey: 'choiceC' } } } "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP088", expectedDiagnosticLevel).And.HaveMessage("The property \"discKey\" expected a value of type \"'choiceA' | 'choiceB'\" but the provided value is of type \"'choiceC'\". Did you mean \"'choiceA'\"?") ); } { // discriminator key supplied, required value omitted var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { myDisc1: { discKey: 'choiceA' } } } "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP035", expectedDiagnosticLevel).And.HaveMessage("The specified object is missing the following required properties: \"valueA\".") ); } { // discriminator key supplied, case of required property is incorrect var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { myDisc1: { discKey: 'choiceA' ValueA: 'hello' } } } "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP035", expectedDiagnosticLevel).And.HaveMessage("The specified object is missing the following required properties: \"valueA\"."), x => x.Should().HaveCodeAndSeverity("BCP089", expectedDiagnosticLevel).And.HaveMessage("The property \"ValueA\" is not allowed on objects of type \"choiceA\". Did you mean \"valueA\"?") ); } { // all good, incorrect property access var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { myDisc1: { discKey: 'choiceA' valueA: 'hello' } } } output valueA string = myRes.properties.myDisc1.valueA output valueB string = myRes.properties.myDisc1.valuuuueB "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"choiceA\" does not contain property \"valuuuueB\". Available properties include \"discKey\", \"valueA\".") ); } { // all good, incorrect property access with suggestion var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { myDisc1: { discKey: 'choiceA' valueA: 'hello' } } } output valueA string = myRes.properties.myDisc1.valueA output valueB string = myRes.properties.myDisc1.valueB "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP083", expectedDiagnosticLevel).And.HaveMessage("The type \"choiceA\" does not contain property \"valueB\". Did you mean \"valueA\"?") ); } }
public static ResourceTypeComponents CreateCustomResourceTypeWithTopLevelProperties(string fullyQualifiedType, string apiVersion, TypeSymbolValidationFlags validationFlags, IEnumerable <TypeProperty>?additionalTopLevelProperties = null, params TypeProperty[] customProperties) { var reference = ResourceTypeReference.Parse($"{fullyQualifiedType}@{apiVersion}"); var resourceProperties = AzResourceTypeProvider.GetCommonResourceProperties(reference) .Concat(additionalTopLevelProperties ?? Enumerable.Empty <TypeProperty>()) .Concat(new TypeProperty("properties", new ObjectType("properties", validationFlags, customProperties, null), TypePropertyFlags.Required)); var bodyType = new ObjectType(reference.FormatName(), validationFlags, resourceProperties, null); return(new ResourceTypeComponents(reference, ResourceScope.Tenant | ResourceScope.ManagementGroup | ResourceScope.Subscription | ResourceScope.ResourceGroup | ResourceScope.Resource, bodyType)); }
public static ResourceTypeComponents CreateCustomResourceType(string fullyQualifiedType, string apiVersion, TypeSymbolValidationFlags validationFlags, params TypeProperty[] customProperties) { return(CreateCustomResourceTypeWithTopLevelProperties(fullyQualifiedType, apiVersion, validationFlags, null, customProperties)); }
public static ResourceTypeComponents CreateCustomResourceType(string fullyQualifiedType, string apiVersion, TypeSymbolValidationFlags validationFlags, params TypeProperty[] customProperties) { var reference = ResourceTypeReference.Parse($"{fullyQualifiedType}@{apiVersion}"); var resourceProperties = LanguageConstants.GetCommonResourceProperties(reference) .Concat(new TypeProperty("properties", new ObjectType("properties", validationFlags, customProperties, null), TypePropertyFlags.Required)); var bodyType = new ObjectType(reference.FormatName(), validationFlags, resourceProperties, null); return(new ResourceTypeComponents(reference, ResourceScope.Tenant | ResourceScope.ManagementGroup | ResourceScope.Subscription | ResourceScope.ResourceGroup | ResourceScope.Resource, bodyType)); }
public TypedArrayType(ITypeReference itemReference, TypeSymbolValidationFlags validationFlags) : base(itemReference.Type.Name + "[]") { this.Item = itemReference; ValidationFlags = validationFlags; }
public void Type_validation_runs_on_compilation_common_failures(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) { var customTypes = new [] { CreateCustomResourceType("My.Rp/myType", "2020-01-01", validationFlags, new TypeProperty("readOnlyProp", LanguageConstants.String, TypePropertyFlags.ReadOnly), new TypeProperty("writeOnlyProp", LanguageConstants.String, TypePropertyFlags.WriteOnly), new TypeProperty("requiredProp", LanguageConstants.String, TypePropertyFlags.Required), new TypeProperty("additionalProps", new NamedObjectType( "additionalProps", validationFlags, new [] { new TypeProperty("propA", LanguageConstants.String, TypePropertyFlags.Required), new TypeProperty("propB", LanguageConstants.String), }, LanguageConstants.Int )), new TypeProperty("nestedObj", new NamedObjectType( "nestedObj", validationFlags, new [] { new TypeProperty("readOnlyNestedProp", LanguageConstants.String, TypePropertyFlags.ReadOnly), new TypeProperty("writeOnlyNestedProp", LanguageConstants.String, TypePropertyFlags.WriteOnly), new TypeProperty("requiredNestedProp", LanguageConstants.String, TypePropertyFlags.Required), }, null ))), }; var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' properties: { readOnlyProp: 123 writeOnlyProp: 456 additionalProps: { propB: 123 } nestedObj: { readOnlyNestedProp: 123 writeOnlyNestedProp: 456 } } } output writeOnlyOutput string = myRes.properties.writeOnlyProp output writeOnlyOutput2 string = myRes.properties.nestedObj.writeOnlyProp output missingOutput string = myRes.properties.missingOutput output missingOutput2 string = myRes.properties.nestedObj.missingOutput output incorrectTypeOutput int = myRes.properties.readOnlyProp output incorrectTypeOutput2 int = myRes.properties.nestedObj.readOnlyProp "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP035", expectedDiagnosticLevel).And.HaveMessage("The specified object is missing the following required properties: \"requiredProp\"."), x => x.Should().HaveCodeAndSeverity("BCP073", expectedDiagnosticLevel).And.HaveMessage("The property \"readOnlyProp\" is read-only. Expressions cannot be assigned to read-only properties."), x => x.Should().HaveCodeAndSeverity("BCP036", expectedDiagnosticLevel).And.HaveMessage("The property \"writeOnlyProp\" expected a value of type \"string\" but the provided value is of type \"int\"."), x => x.Should().HaveCodeAndSeverity("BCP035", expectedDiagnosticLevel).And.HaveMessage("The specified object is missing the following required properties: \"propA\"."), x => x.Should().HaveCodeAndSeverity("BCP036", expectedDiagnosticLevel).And.HaveMessage("The property \"propB\" expected a value of type \"string\" but the provided value is of type \"int\"."), x => x.Should().HaveCodeAndSeverity("BCP035", expectedDiagnosticLevel).And.HaveMessage("The specified object is missing the following required properties: \"requiredNestedProp\"."), x => x.Should().HaveCodeAndSeverity("BCP073", expectedDiagnosticLevel).And.HaveMessage("The property \"readOnlyNestedProp\" is read-only. Expressions cannot be assigned to read-only properties."), x => x.Should().HaveCodeAndSeverity("BCP036", expectedDiagnosticLevel).And.HaveMessage("The property \"writeOnlyNestedProp\" expected a value of type \"string\" but the provided value is of type \"int\"."), x => x.Should().HaveCodeAndSeverity("BCP077", expectedDiagnosticLevel).And.HaveMessage("The property \"writeOnlyProp\" on type \"properties\" is write-only. Write-only properties cannot be accessed."), x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"nestedObj\" does not contain property \"writeOnlyProp\". Available properties include \"readOnlyNestedProp\", \"requiredNestedProp\"."), x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"properties\" does not contain property \"missingOutput\". Available properties include \"additionalProps\", \"nestedObj\", \"readOnlyProp\", \"requiredProp\"."), x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"nestedObj\" does not contain property \"missingOutput\". Available properties include \"readOnlyNestedProp\", \"requiredNestedProp\"."), x => x.Should().HaveCodeAndSeverity("BCP026", DiagnosticLevel.Error).And.HaveMessage("The output expects a value of type \"int\" but the provided value is of type \"string\"."), x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"nestedObj\" does not contain property \"readOnlyProp\". Available properties include \"readOnlyNestedProp\", \"requiredNestedProp\".") ); }
public TypedArrayType(ITypeReference itemReference, TypeSymbolValidationFlags validationFlags) : base(FormatTypeName(itemReference)) { this.Item = itemReference; ValidationFlags = validationFlags; }
public ObjectType(string name, TypeSymbolValidationFlags validationFlags, IEnumerable <TypeProperty> properties, ITypeReference?additionalPropertiesType, TypePropertyFlags additionalPropertiesFlags = TypePropertyFlags.None, IEnumerable <FunctionOverload>?functions = null) : this(name, validationFlags, properties, additionalPropertiesType, additionalPropertiesFlags, owner => new FunctionResolver(owner, functions ?? ImmutableArray <FunctionOverload> .Empty)) { }
public PrimitiveType(string name, TypeSymbolValidationFlags validationFlags) : base(name) { ValidationFlags = validationFlags; }
public static ResourceType CreateCustomResourceType(string fullyQualifiedType, string apiVersion, TypeSymbolValidationFlags validationFlags, params TypeProperty[] customProperties) { var reference = ResourceTypeReference.Parse($"{fullyQualifiedType}@{apiVersion}"); var resourceProperties = LanguageConstants.GetCommonResourceProperties(reference) .Concat(new TypeProperty("properties", new NamedObjectType("properties", validationFlags, customProperties, null), TypePropertyFlags.Required)); return(new ResourceType(reference, new NamedObjectType(reference.FormatName(), validationFlags, resourceProperties, null))); }
public void Type_validation_runs_on_compilation_common_failures(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) { var customTypes = new[] { TestTypeHelper.CreateCustomResourceTypeWithTopLevelProperties("My.Rp/myType", "2020-01-01", validationFlags, new [] { new TypeProperty("readOnlyTopLevelProp", LanguageConstants.String, TypePropertyFlags.ReadOnly) }, new TypeProperty("readOnlyProp", LanguageConstants.String, TypePropertyFlags.ReadOnly), new TypeProperty("writeOnlyProp", LanguageConstants.String, TypePropertyFlags.WriteOnly | TypePropertyFlags.AllowImplicitNull), new TypeProperty("requiredProp", LanguageConstants.String, TypePropertyFlags.Required), new TypeProperty("additionalProps", new ObjectType( "additionalProps", validationFlags, new [] { new TypeProperty("propA", LanguageConstants.String, TypePropertyFlags.Required), new TypeProperty("propB", LanguageConstants.String, TypePropertyFlags.AllowImplicitNull), }, LanguageConstants.Int )), new TypeProperty("nestedObj", new ObjectType( "nestedObj", validationFlags, new [] { new TypeProperty("readOnlyNestedProp", LanguageConstants.String, TypePropertyFlags.ReadOnly), new TypeProperty("writeOnlyNestedProp", LanguageConstants.String, TypePropertyFlags.WriteOnly | TypePropertyFlags.AllowImplicitNull), new TypeProperty("requiredNestedProp", LanguageConstants.String, TypePropertyFlags.Required), }, null ))), }; var program = @" resource myRes 'My.Rp/myType@2020-01-01' = { name: 'steve' id: '/subscriptions/guid/resourceGroups/rg/My.Rp/myType/steve' type: 'My.Rp/myType' apiVersion: '2020-01-01' readOnlyTopLevelProp: 'abcd' properties: { readOnlyProp: 123 writeOnlyProp: 456 additionalProps: { propB: 123 } nestedObj: { readOnlyNestedProp: 123 writeOnlyNestedProp: 456 } } } output writeOnlyOutput string = myRes.properties.writeOnlyProp output writeOnlyOutput2 string = myRes.properties.nestedObj.writeOnlyProp output missingOutput string = myRes.properties.missingOutput output missingOutput2 string = myRes.properties.nestedObj.missingOutput output incorrectTypeOutput int = myRes.properties.readOnlyProp output incorrectTypeOutput2 int = myRes.properties.nestedObj.readOnlyProp "; var model = GetSemanticModelForTest(program, customTypes); model.GetAllDiagnostics().Should().SatisfyRespectively( x => x.Should().HaveCodeAndSeverity("BCP073", expectedDiagnosticLevel).And.HaveMessage("The property \"id\" is read-only. Expressions cannot be assigned to read-only properties."), x => x.Should().HaveCodeAndSeverity("BCP073", expectedDiagnosticLevel).And.HaveMessage("The property \"type\" is read-only. Expressions cannot be assigned to read-only properties."), x => x.Should().HaveCodeAndSeverity("BCP073", expectedDiagnosticLevel).And.HaveMessage("The property \"apiVersion\" is read-only. Expressions cannot be assigned to read-only properties."), x => x.Should().HaveCodeAndSeverity("BCP073", DiagnosticLevel.Warning).And.HaveMessage("The property \"readOnlyTopLevelProp\" is read-only. Expressions cannot be assigned to read-only properties. If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP035", DiagnosticLevel.Warning).And.HaveMessage("The specified \"object\" declaration is missing the following required properties: \"requiredProp\". If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP073", DiagnosticLevel.Warning).And.HaveMessage("The property \"readOnlyProp\" is read-only. Expressions cannot be assigned to read-only properties. If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP036", DiagnosticLevel.Warning).And.HaveMessage("The property \"writeOnlyProp\" expected a value of type \"null | string\" but the provided value is of type \"int\". If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP035", DiagnosticLevel.Warning).And.HaveMessage("The specified \"object\" declaration is missing the following required properties: \"propA\". If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP036", DiagnosticLevel.Warning).And.HaveMessage("The property \"propB\" expected a value of type \"null | string\" but the provided value is of type \"int\". If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP035", DiagnosticLevel.Warning).And.HaveMessage("The specified \"object\" declaration is missing the following required properties: \"requiredNestedProp\". If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP073", DiagnosticLevel.Warning).And.HaveMessage("The property \"readOnlyNestedProp\" is read-only. Expressions cannot be assigned to read-only properties. If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP036", DiagnosticLevel.Warning).And.HaveMessage("The property \"writeOnlyNestedProp\" expected a value of type \"null | string\" but the provided value is of type \"int\". If this is an inaccuracy in the documentation, please report it to the Bicep Team."), x => x.Should().HaveCodeAndSeverity("BCP077", expectedDiagnosticLevel).And.HaveMessage("The property \"writeOnlyProp\" on type \"properties\" is write-only. Write-only properties cannot be accessed."), x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"nestedObj\" does not contain property \"writeOnlyProp\". Available properties include \"readOnlyNestedProp\", \"requiredNestedProp\"."), x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"properties\" does not contain property \"missingOutput\". Available properties include \"additionalProps\", \"nestedObj\", \"readOnlyProp\", \"requiredProp\"."), x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"nestedObj\" does not contain property \"missingOutput\". Available properties include \"readOnlyNestedProp\", \"requiredNestedProp\"."), x => x.Should().HaveCodeAndSeverity("BCP026", DiagnosticLevel.Error).And.HaveMessage("The output expects a value of type \"int\" but the provided value is of type \"string\"."), x => x.Should().HaveCodeAndSeverity("BCP053", expectedDiagnosticLevel).And.HaveMessage("The type \"nestedObj\" does not contain property \"readOnlyProp\". Available properties include \"readOnlyNestedProp\", \"requiredNestedProp\".") ); }