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

OpenApi.json / yaml are not the same as one available during runtime #51

Open
ewoks opened this issue Aug 4, 2020 · 3 comments
Open

Comments

@ewoks
Copy link

ewoks commented Aug 4, 2020

Describe the bug
generated json|yaml file has different content than one available on host:8080/openapi

To Reproduce

  1. execute: $ mvn io.openapitools.swagger:swagger-maven-plugin:2.1.4:generate
  2. start application and send request like: curl <host>:8080/openapi > runtime_openapi.yaml
  3. compare the files with diff <generated>-openapi.yaml runtime_openapi.yaml
<       operationId: getAll
29,30c10,11
<         default:
<           description: default response
---
>         "200":
>           description: OK
34,37c15
<                 uniqueItems: true
<                 type: array
<                 items:
<                   $ref: '#/components/schemas/Fruit'
---
>                 $ref: '#/components/schemas/SetFruit'
39d16
<       operationId: add
46,47c23,24
<         default:
<           description: default response
---
74d43
<       operationId: hello
76,77c45,46
<         default:
<           description: default response
---
>         "200":
>           description: OK
84,89c53,58
<       operationId: greeting
<       requestBody:
<         content:
<           '*/*':
<             schema:
<               type: string
---
>       parameters:
>       - name: name
>         in: path
>         required: true
>         schema:
>           type: string
91,92c60,61
<         default:
<           description: default response
---
>         "200":
>           description: OK

Expected behavior
Both generated and runtime available openapi spec have the same content

@ewoks
Copy link
Author

ewoks commented Aug 4, 2020

@langecode maybe I misunderstood something? Your opinion would be very appreciated

@langecode
Copy link
Member

Hi @ewoks

I think there could be a couple of things here. First of all your runtime generation and the build time generation may not run the same version of the Swagger library. I would think this may cause the difference.

Second I am not sure which of the two OpenAPI specifications you actually consider the most correct one? It seems the one have a "default" response where the other has "200". I am not quite sure what is the most correct - of course if you actually did document your responses using the Swagger OpenAPI annotations in the code that should be reflected in the generated documentation. However, if you have not actually documented anything I think it may be a bit more tricky.

@langecode
Copy link
Member

Could you attach or link to both of the documents? Or would that reveal anything confidential...

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

No branches or pull requests

2 participants