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

Enhancement: Allow a normal route for the "docs" (custom controller / renderer) #2400

Open
WilliamStam opened this issue Oct 5, 2023 · 3 comments
Labels
Enhancement This is a new feature or request OpenAPI This is related to our OpenAPI schema

Comments

@WilliamStam
Copy link
Contributor

WilliamStam commented Oct 5, 2023

Summary

Right now the OpenAPIController limits the docs to redoc and swagger. it might be a nice idea to allow a normal "route" to serve the main html doc file. allow a controller function in the APIController to render whichever docs template that is required similar to how templating etc work instead of "hard coding" it in.

Im really enjoying https://rapidocweb.com/ at the moment.

seems the only way is to keep the OpenAPIController path to /schema for /schema/openapi.json and then add another route to render a template that loads the spec file from /schema/openapi.json. making it openapi front end independent could be a good idea.

Basic Example

async def docs_controller(openapi_config, request) -> Template:
    return Template(....)
    
class APIDocsController(OpenAPIController):
    path = "/schema"
    docs_controller=docs_controller #render_controller ?
    

Drawbacks and Impact

adding in more "generic" code and potentially bloating the OpenAPIController. in future even the redocs / swagger can be migrated as "plugin" docs which would actualy make the code base easier to maintain and cleaner

Unresolved questions

No response


Funding

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@WilliamStam WilliamStam added the Enhancement This is a new feature or request label Oct 5, 2023
@WilliamStam WilliamStam changed the title Enhancement: Allow a normal route for the "docs" Enhancement: Allow a normal route for the "docs" (custom controller / renderer) Oct 5, 2023
@JacobCoffee
Copy link
Member

I think I like this idea, not sure of the heft it would add (which may be none if we move this type of stuff out into a plugin)

@orgarten
Copy link
Contributor

orgarten commented Nov 2, 2023

If I understand this correctly, this would be addressed by #2541 ?

@JacobCoffee
Copy link
Member

It would be in scope of that change, although not the original intent I think

@JacobCoffee JacobCoffee added the OpenAPI This is related to our OpenAPI schema label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement This is a new feature or request OpenAPI This is related to our OpenAPI schema
Projects
Status: Ideas
Development

No branches or pull requests

3 participants