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

Feature request for support example attribute for elements #22

Closed
oozolii opened this issue Oct 26, 2017 · 4 comments
Closed

Feature request for support example attribute for elements #22

oozolii opened this issue Oct 26, 2017 · 4 comments

Comments

@oozolii
Copy link

oozolii commented Oct 26, 2017

Dear Developer(s),

I want to ask you to develop PHPSwaggerGen to support example attribute for swagger.
What I mean?

responses:
200:
description: 'Succes data request'
schema:
properties:
code:
type: string
example: "SUCCESS"
message:
type: string
example: "Your request was successfully!"

More about this attribute: https://swagger.io/docs/specification/adding-examples/

Would be nice to have this feature too. Thank you!

@vanderlee
Copy link
Owner

I think that would be quite doable. Will look into it somewhere in the coming weeks.
Do you know if the SwaggerUI can handle examples.

@oozolii
Copy link
Author

oozolii commented Oct 26, 2017

Thank you very much! SwaggerUI can handle examples.
Check here in the example:
http://petstore.swagger.io/?_ga=2.136686704.1540059357.1509039902-598612444.1509039902

And here is the json for that: http://petstore.swagger.io/v2/swagger.json

The "example" shows up in the UI when you see eg. the "Add a new pet to the store" body options object.

@vanderlee
Copy link
Owner

I've added support for example to all types and to the Response context.

Note that PHPSwaggerGen bases off the 2.0 spec. Relevant page on examples is here: https://swagger.io/docs/specification/2-0/adding-examples/.

The page you linked to was for OAS3. I may support 3.0 in the future, but currently have no plans to do so.

@oozolii
Copy link
Author

oozolii commented Oct 30, 2017

Thank you very much!

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