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] Docs: add a complete example of docs (swagger) customization #995

Open
pawamoy opened this issue Feb 18, 2020 · 4 comments · May be fixed by #1519
Open

[FEATURE] Docs: add a complete example of docs (swagger) customization #995

pawamoy opened this issue Feb 18, 2020 · 4 comments · May be fixed by #1519
Labels

Comments

@pawamoy
Copy link
Contributor

@pawamoy pawamoy commented Feb 18, 2020

Maintainers and contributors: thank you very much! 🚀

Is your feature request related to a problem

Currently, the documentation on how to customize the interactive Swagger interface is spread over many different pages, making it difficult to grasp what is possible and how it should be done (response_model, response_class, dicts, routes/decorators arguments, Body arguments, FastAPI arguments, Pydantic models and schemas, docstrings, docstrings markers, etc.).

The auto-generated interactive documentation page is real plus when using FastAPI, so at some point one wants to make it complete with descriptions and examples. Instead of skimming through multiple pages searching for this documentation-related information, it would be absolutely great to have a first-class "Documenting your API" page with a complete example!

I think it would help separating the work for new projects in two clear phases: implementation/experimentation, and refining/completion of the API interface. Once one is comfortable with how documenting is done, both phases can be merged again when adding new functionality.

The solution you would like

Add a page containing a full example of documentation/customization with query, body, cookie parameters examples and descriptions, responses codes, descriptions, examples and content types, tags, main title, main description, main version, etc.

Describe alternatives you've considered

Maybe a good starting point would be to have a page with links pointing to the interesting sections 🙂

@pawamoy pawamoy added the enhancement label Feb 18, 2020
@dmontagu
Copy link
Collaborator

@dmontagu dmontagu commented Feb 18, 2020

I personally would be in favor of adding a "table of contents"-style page for OpenAPI-related functionality (and perhaps also other groups of functionality that are spread across different pages).

@tiangolo
Copy link
Owner

@tiangolo tiangolo commented Apr 13, 2020

Yeah, I guess that could be okay, although as all FastAPI is built around OpenAPI, it would probably end up having links to almost all the sections in the docs, so, not sure... Then the next issue would be making sure to have it in sync with the docs when they update...

But anyway, would you like to write a PR @pawamoy ?

@pawamoy
Copy link
Contributor Author

@pawamoy pawamoy commented Apr 13, 2020

@tiangolo, sure, I'm always willing to resolve the issues I open, though I'm not sure when I'll be able to work on this 🙂

@mircohaug
Copy link

@mircohaug mircohaug commented Apr 17, 2020

I am looking for exactly this page 🙂 can you provide a quick peek on how to attach descriptions to parameters and model fields. Docstrings at the method level are only set as description of the whole method. Individual documentation of method parameters is not possible this way. If I have this information I could also at least start the docs page.

mircohaug added a commit to mircohaug/fastapi that referenced this issue Jun 5, 2020
Add a new documentation page which displays example with a fully documented api.

Closes tiangolo#995
@mircohaug mircohaug linked a pull request that will close this issue Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.