Skip to content

[fix included] produces / consumes mapping is generated multiple times #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JonasGroeger opened this issue Apr 22, 2021 · 2 comments
Closed
Labels
bug Something isn't working
Milestone

Comments

@JonasGroeger
Copy link

JonasGroeger commented Apr 22, 2021

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(", ")
@JonasGroeger JonasGroeger changed the title produces / consumes mapping is generated multiple times [fix included] produces / consumes mapping is generated multiple times Apr 22, 2021
@hauner hauner added the bug Something isn't working label Apr 22, 2021
@hauner
Copy link
Member

hauner commented Apr 22, 2021

yes, the example makes the missing distinct quite obvious 🤨

Thanks for reporting.

hauner added a commit to openapi-processor/openapi-processor-core that referenced this issue Apr 23, 2021
hauner added a commit to openapi-processor/openapi-processor-core that referenced this issue Apr 23, 2021
hauner added a commit that referenced this issue Apr 23, 2021
hauner added a commit that referenced this issue Apr 23, 2021
hauner added a commit to openapi-processor/openapi-processor-micronaut that referenced this issue Apr 23, 2021
hauner added a commit to openapi-processor/openapi-processor-micronaut that referenced this issue Apr 23, 2021
@hauner hauner added this to the 2021.3.1 milestone Apr 23, 2021
hauner added a commit to openapi-processor/openapi-processor-core that referenced this issue Apr 25, 2021
hauner added a commit to openapi-processor/openapi-processor-core that referenced this issue Apr 25, 2021
hauner added a commit that referenced this issue Apr 25, 2021
hauner added a commit that referenced this issue Apr 25, 2021
(cherry picked from commit 8918398)
hauner added a commit that referenced this issue Apr 25, 2021
hauner added a commit to openapi-processor/openapi-processor-micronaut that referenced this issue Apr 25, 2021
hauner added a commit to openapi-processor/openapi-processor-micronaut that referenced this issue Apr 25, 2021
hauner added a commit to openapi-processor/openapi-processor-micronaut that referenced this issue Apr 25, 2021
@hauner
Copy link
Member

hauner commented Apr 25, 2021

fixed & published in 2021.3.1

@hauner hauner closed this as completed Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants