You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using springdoc in a spring boot application. I have a controller method which its only parameter is annotated with @Schema(implementation = String.class, allowableValues = {"foo", "bar"})
When I check /v3/api-docs, I found there was no enum field for the test parameter in /test endpoint. I did some debugging into the source code and found there may be a bug in the getSchema method in AnnotationsUtils class of module swagger-core-jakarta. At line 1719, the method resolveSchemaFromType returns a StringSchema without enum, maybe an additional condition schemaAnnotation.allowableValues().length != 0 should be checked.
I'm using springdoc in a spring boot application. I have a controller method which its only parameter is annotated with @Schema(implementation = String.class, allowableValues = {"foo", "bar"})
When I check /v3/api-docs, I found there was no enum field for the test parameter in /test endpoint. I did some debugging into the source code and found there may be a bug in the getSchema method in AnnotationsUtils class of module swagger-core-jakarta.
At line 1719, the method resolveSchemaFromType returns a StringSchema without enum, maybe an additional condition schemaAnnotation.allowableValues().length != 0 should be checked.
{ "openapi": "3.0.1", "info": { "title": "OpenAPI definition", "version": "v0" }, "servers": [ { "url": "http://localhost:9090", "description": "Generated server url" } ], "paths": { "/test": { "post": { "tags": [ "hello-controller" ], "summary": "Test schema", "operationId": "test", "parameters": [ { "name": "test", "in": "query", "description": "test request parameter", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "type": "string" } } } } } } }, "/test2": { "post": { "tags": [ "hello-controller" ], "summary": "Test2 schema", "operationId": "test2", "parameters": [ { "name": "test", "in": "query", "description": "test request parameter", "required": true, "schema": { "type": "string", "enum": [ "foo", "bar" ] } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "type": "string" } } } } } } } }, "components": {} }
Demo application:
springdoc-demo.zip
Spring Boot: 3.3.1
springdoc-openapi-starter-webmvc-ui: 2.6.0
swagger-core-jakarta: 2.2.22
The text was updated successfully, but these errors were encountered: