pyeve / eve-swagger

Swagger extension for Eve-powered RESTful APIs
http://python-eve.org
Other
154 stars 43 forks source link

add support for swagger schema example field #59

Closed thomasleveil closed 6 years ago

thomasleveil commented 6 years ago

See https://swagger.io/docs/specification/2-0/adding-examples/

The description field is already supported, it would be nice to also support the example field in schema. This would make swagger-ui provide ready to use data in requests.

nicolaiarocci commented 6 years ago

This looks like a rather trivial implementation and I agree, it would be useful. Feel free to submit a PR for it!

thomasleveil commented 6 years ago

@nicolaiarocci I noticed that when using either description or example in python-eve schema, Cerberus complains about those unknown fields. Should the fix be on python-eve or should it be on the Cerberus side?

nicolaiarocci commented 6 years ago

As reported in the README:

NOTE: As with the description, the field TRANSPARENT_SCHEMA_RULES must be enabled in your settings.py, otherwise the Cerberus library will display an error about "unknown field 'example' for field[yourFieldName]".