File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/OpenApi/src/Services/Schemas Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -107,25 +107,26 @@ internal sealed class OpenApiSchemaService(
107107 }
108108 if ( context . PropertyInfo is { AttributeProvider : { } attributeProvider } )
109109 {
110+ var propertyAttributes = attributeProvider . GetCustomAttributes ( inherit : false ) ;
110111 var isInlinedSchema = schema [ OpenApiConstants . SchemaId ] is null ;
111112 if ( isInlinedSchema )
112113 {
113- if ( attributeProvider . GetCustomAttributes ( inherit : false ) . OfType < ValidationAttribute > ( ) is { } validationAttributes )
114+ if ( propertyAttributes . OfType < ValidationAttribute > ( ) is { } validationAttributes )
114115 {
115116 schema . ApplyValidationAttributes ( validationAttributes ) ;
116117 }
117- if ( attributeProvider . GetCustomAttributes ( inherit : false ) . OfType < DefaultValueAttribute > ( ) . LastOrDefault ( ) is { } defaultValueAttribute )
118+ if ( propertyAttributes . OfType < DefaultValueAttribute > ( ) . LastOrDefault ( ) is { } defaultValueAttribute )
118119 {
119120 schema . ApplyDefaultValue ( defaultValueAttribute . Value , context . TypeInfo ) ;
120121 }
121- if ( attributeProvider . GetCustomAttributes ( inherit : false ) . OfType < DescriptionAttribute > ( ) . LastOrDefault ( ) is { } descriptionAttribute )
122+ if ( propertyAttributes . OfType < DescriptionAttribute > ( ) . LastOrDefault ( ) is { } descriptionAttribute )
122123 {
123124 schema [ OpenApiSchemaKeywords . DescriptionKeyword ] = descriptionAttribute . Description ;
124125 }
125126 }
126127 else
127128 {
128- if ( attributeProvider . GetCustomAttributes ( inherit : false ) . OfType < DescriptionAttribute > ( ) . LastOrDefault ( ) is { } descriptionAttribute )
129+ if ( propertyAttributes . OfType < DescriptionAttribute > ( ) . LastOrDefault ( ) is { } descriptionAttribute )
129130 {
130131 schema [ OpenApiConstants . RefDescriptionAnnotation ] = descriptionAttribute . Description ;
131132 }
You can’t perform that action at this time.
0 commit comments