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

Add schema to GET responses in OpenApi definition #817

Closed
samuba opened this issue Feb 26, 2017 · 2 comments
Closed

Add schema to GET responses in OpenApi definition #817

samuba opened this issue Feb 26, 2017 · 2 comments

Comments

@samuba
Copy link

samuba commented Feb 26, 2017

Right now the OpenApi definition does not provide a schema for the GET responses.
Those definitions already exists (they are e.g. used for POST parameters) and it would be nice to also have them included in the GET responses.
This would make the API definition more complete and enable clients, for example swagger-ui, to always show the model or even example results of the endpoint.
See for example: http://petstore.swagger.io/#!/pet/getPetById

Currently the OpenApi definition for a GET endpoint response looks like this:

"responses": {
    "206": {
        "description": "Partial Content"
     },
     "200": {
         "description": "OK"
     }
 }

Including the schema would look like this:

"responses": {
    "206": {
        "description": "Partial Content"
     },
     "200": {
         "description": "OK",
         "schema": {
             "$ref": "#/definitions/film"
          }
     }
 }
@mpwang
Copy link

mpwang commented May 2, 2017

I think the change is necessary, otherwise when using swagger-codegen, the generated library will return none for any get method

@ruslantalpa
Copy link
Contributor

fixed by #885

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

No branches or pull requests

3 participants