Skip to content
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

Cannot referenced example in RequestBody #1276

Closed
EstebanDugueperoux2 opened this issue Sep 24, 2021 · 0 comments
Closed

Cannot referenced example in RequestBody #1276

EstebanDugueperoux2 opened this issue Sep 24, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@EstebanDugueperoux2
Copy link

Describe the bug
I have an OpenAPI v3 contract interface generated using SpringDoc from Spring Boot java code.
I try to have a JSON requestBody example reference:

            "requestBody":{
               "description":"A commission to update",
               "content":{
                  "application/json":{
                     "schema":{
                        "$ref":"#/components/schemas/CommissionDto"
                     },
                     "examples":{
                        "requestExample":{
                           **"description": "requestExample",**
                           "$ref":"#/components/examples/httpPutCommissionRequestBodyExample"
                        }
                     }
                  }
               },
               "required":true
            }

but "description" field is added which is not standard, consequently validator failed on my contract interface.
And this came from https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java#L317 which is called indirectly by SpringDoc.

To Reproduce
To reproduce I have attached a JUnit test case.

fix-Add-JUnit-test.zip

Regards.

@bnasslahsen bnasslahsen added the bug Something isn't working label Jan 10, 2022
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