jsontopydantic
jsontopydantic copied to clipboard
Include generated examples
It it's extremely nice to load examples when building an API, since the OpenAPI specification is going to contain an example value from the actual response. If you are building a validator for an actual object, you know more or less how the data should look like. Here are the relevant docs for this feature: https://fastapi.tiangolo.com/tutorial/schema-extra-example/
This MR adds another customizer to include the examples when generating the model. Here is a preview:
Of course, when presented with multiple options, it will pick the first:
Closes #14
Suggested and implemented during a Hackergarten: https://www.meetup.com/pt-BR/hackergarten-stuttgart/, thanks everyone who participated 😃