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

Support "examples" documentation #71

Open
tyree731 opened this issue Jan 5, 2024 · 2 comments
Open

Support "examples" documentation #71

tyree731 opened this issue Jan 5, 2024 · 2 comments

Comments

@tyree731
Copy link

tyree731 commented Jan 5, 2024

As far as I can tell, nothing in this module allows you to specify example responses for different models. It would be nice if, perhaps through some decorator applied to a method on a pydantic model, one could provide an example response that the API might return, having that example response propagated through to the openapi spec and documentation.

@nkwade
Copy link

nkwade commented May 16, 2024

I second this, I was searching for how to provide an example response. I have to put an example response in my docstring now which will just look weird and people would have to look thru 2 "example response" section. Just being able to edit this myself would be great.

@pgjones
Copy link
Owner

pgjones commented May 16, 2024

This is already possible with Pydantic models, but not with others see https://docs.pydantic.dev/latest/concepts/json_schema/#using-json_schema_extra-with-a-dict and 93f2620. I'll document this if msgspec also supports, see jcrist/msgspec#689.

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

3 participants