Closed JonasGroeger closed 3 years ago
There must be a distinct filter applied to the produces and consumes mappings since otherwise it generates the following structure:
@GetMapping( path = "/destinations", produces = { "application/json", "application/json", "application/json", "application/json" }) ResponseEntity<?> getAllDestinations();
from this yaml:
paths: '/destinations': get: responses: '200': description: OK content: application/json: schema: '$ref': '#/components/schemas/GetAllDestinationsResponse' '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse'
Fix:
https://github.com/openapi-processor/openapi-processor-spring/blob/b6cc315f3d08d0f7f7c40162faf0e86b77d6e047/src/main/kotlin/io/openapiprocessor/spring/writer/java/MappingAnnotationWriter.kt#L46
mapping += consumes.map { quote(it) }.distinct().joinToString(", ")
https://github.com/openapi-processor/openapi-processor-spring/blob/b6cc315f3d08d0f7f7c40162faf0e86b77d6e047/src/main/kotlin/io/openapiprocessor/spring/writer/java/MappingAnnotationWriter.kt#L57
mapping += produces.map { quote(it) }.distinct().joinToString(", ")
yes, the example makes the missing distinct quite obvious 🤨
Thanks for reporting.
fixed & published in 2021.3.1
There must be a distinct filter applied to the produces and consumes mappings since otherwise it generates the following structure:
from this yaml:
Fix:
https://github.com/openapi-processor/openapi-processor-spring/blob/b6cc315f3d08d0f7f7c40162faf0e86b77d6e047/src/main/kotlin/io/openapiprocessor/spring/writer/java/MappingAnnotationWriter.kt#L46
https://github.com/openapi-processor/openapi-processor-spring/blob/b6cc315f3d08d0f7f7c40162faf0e86b77d6e047/src/main/kotlin/io/openapiprocessor/spring/writer/java/MappingAnnotationWriter.kt#L57