Skip to content

Cannot referenced example in RequestBody #1276

Closed
@EstebanDugueperoux2

Description

@EstebanDugueperoux2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions