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

Does it support example #18671

Open
zhucj1028 opened this issue May 14, 2024 · 2 comments
Open

Does it support example #18671

zhucj1028 opened this issue May 14, 2024 · 2 comments

Comments

@zhucj1028
Copy link

Currently, trying various syntax and versions, examples cannot be converted to Asciidoc. Is this a bug? If not, please advise on how to export examples in OpenAPI 3.0 and above versions. I saw that I submitted the relevant issue a long time ago, but did not fix it, is that so? I don't think great tools should be like this.

https://github.com/OpenAPITools/openapi-generator/issues/5710

@DLMartin-
Copy link

I ran into this issue today while experimenting with the expressjs generated server. In the generated openapi.yaml file, the POST for /pets is not correct. It currently looks like this:

  /pet:
    post:
      description: ""
      operationId: addPet
      requestBody:
        $ref: '#/components/requestBodies/Pet'

But it should look like this (for JSON):

  /pet:
    post:
      description: ""
      operationId: addPet
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/requestBodies/Pet"

I'm not sure which other paths may be broken, but it was annoying. Is this just an issue with the example PetStore yaml file?

@zhucj1028
Copy link
Author

zhucj1028 commented May 15, 2024

Need to comply with the OpenAPI specification to

requestBody:
  content:
      application/json:
        schema:

This is my example, but it does not support converting example nodes to asciidoc. I set it up according to the OpenAPI specification, but it is not feasible. I don't know how to configure my yaml file.

/test:
    post:
      summary: summary
      description: description
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/testPOSTReq'
            examples:
              name:
                summary: requestDemo
                value:
                  name: tom
                  type:
                    red: test
                    pom: test2
                    dow:
                      test: test3
                  age: 18
  responses:
    '200':
      description: success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/testPOSTRes200'
          example:
            name: tom
            type:
              red: test
              pom: test2
              dow:
                test: test3
            age: 18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants