public static PropertyDeclarationSyntax AddFromHeaderAttribute( this PropertyDeclarationSyntax propertyDeclaration, string nameProperty, OpenApiSchema schema) { ArgumentNullException.ThrowIfNull(propertyDeclaration); ArgumentNullException.ThrowIfNull(nameProperty); return(propertyDeclaration.AddAttributeLists( SyntaxAttributeListFactory.CreateWithOneItemWithOneArgumentWithNameEquals( nameof(FromHeaderAttribute), nameof(FromHeaderAttribute.Name), nameProperty)) .AddValidationAttributeFromSchemaFormatIfRequired(schema)); }
public static PropertyDeclarationSyntax AddFromQueryAttribute(this PropertyDeclarationSyntax propertyDeclaration, string nameProperty, OpenApiSchema schema) { if (propertyDeclaration == null) { throw new ArgumentNullException(nameof(propertyDeclaration)); } if (nameProperty == null) { throw new ArgumentNullException(nameof(nameProperty)); } return(propertyDeclaration.AddAttributeLists( SyntaxAttributeListFactory.CreateWithOneItemWithOneArgumentWithNameEquals( nameof(FromQueryAttribute), nameof(FromQueryAttribute.Name), nameProperty)) .AddValidationAttributeFromSchemaFormatIfRequired(schema)); }