Describe the bug
Springdoc is not properly substituting variables sourced from a .properties files on Array types such as List<String>;
We are using the springdoc.api-docs.resolve-schema-properties=true feature so we can store our descriptions in a .properties file.
This setup works for all fields types except for List properties. It might even be only be happening with lists of "primitives" such as String.
The result is that we see the un-substituted variable name in the generated open api spec rather than the substituted value.
For example we have a java model two properties like this
@ApiModelProperty( value = "${blahDescription.value}" )
@Schema( description = "${blahDescription.value}" )
String blah;
@ApiModelProperty( value = "${blahDescription.value}" )
@ArraySchema( arraySchema = @Schema( description = "${blahDescription.value}" ),
schema = @Schema( description = "${blahDescription.value}" ) )
List<String> listBlah;
and in our .properties file we have
blahDescription.value="I am description for blah"
This is generating a schema like so
"properties":
{
"listBlah":
{
"type": "array",
"description": "\"I am description for blah\"",
"items":
{
"type": "string",
"description": "${blahDescription.value}"
}
},
"blah":
{
"type": "string",
"description": "\"I am description for blah\""
}
},
Notice in the description of properties.listBlah.items.description the description is ${blahDescription.value} and wasn't substituted correctly.
To Reproduce
Steps to reproduce the behavior:
-
setup a java model with the same properties above and the descriptions sourced from a .properties file.
-
What version of spring-boot you are using?
id 'org.springframework.boot' version '2.3.12.RELEASE' apply false
-
What modules and versions of springdoc-openapi are you using?
dependencySet( group: 'org.springdoc', version: '1.5.10' ) {
entry 'springdoc-openapi-ui'
entry 'springdoc-openapi-webmvc-core'
}
dependency 'io.swagger.core.v3:swagger-annotations:2.1.10'
dependency 'io.swagger:swagger-annotations:1.5.24'
- What is the actual and the expected result using OpenAPI Description (yml or json)?
Expected
"listBlah":
{
"maxItems": 255,
"minItems": 1,
"type": "array",
"description": "\"I am description for blah\"",
"items":
{
"type": "string",
"description": "\"I am description for blah\""
}
},
Actual
"listBlah":
{
"maxItems": 255,
"minItems": 1,
"type": "array",
"description": "\"I am description for blah\"",
"items":
{
"type": "string",
"description": "${blahDescription.value}"
}
},
Describe the bug
Springdoc is not properly substituting variables sourced from a
.propertiesfiles on Array types such asList<String>;We are using the
springdoc.api-docs.resolve-schema-properties=truefeature so we can store our descriptions in a.propertiesfile.This setup works for all fields types except for
Listproperties. It might even be only be happening with lists of "primitives" such asString.The result is that we see the un-substituted variable name in the generated open api spec rather than the substituted value.
For example we have a java model two properties like this
and in our
.propertiesfile we haveThis is generating a schema like so
Notice in the description of
properties.listBlah.items.descriptionthe description is${blahDescription.value}and wasn't substituted correctly.To Reproduce
Steps to reproduce the behavior:
setup a java model with the same properties above and the descriptions sourced from a
.propertiesfile.What version of spring-boot you are using?
id 'org.springframework.boot' version '2.3.12.RELEASE' apply falseWhat modules and versions of springdoc-openapi are you using?
Expected
Actual