[fix included] produces / consumes mapping is generated multiple times
Closed this issue · 2 comments
JonasGroeger commented
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:
mapping += consumes.map {
quote(it)
}.distinct().joinToString(", ")
mapping += produces.map {
quote(it)
}.distinct().joinToString(", ")
hauner commented
yes, the example makes the missing distinct quite obvious 🤨
Thanks for reporting.
hauner commented
fixed & published in 2021.3.1