Skip to content

Commit

Permalink
Fix doc page not updated on plugin activation
Browse files Browse the repository at this point in the history
How to reproduce:
- Launch the Cat
- Goto /docs page
- Activate a plugin with a custom endpoint
- The custom endpoint can be used
- Refresh page /docs
- The new custom endpoint is not there

Why:
The openapi schema is cached by get_openapi_configuration_function

Solution:
Each time a function is decorated with `endpoint`, we flush the cache
  • Loading branch information
sambarza committed Nov 2, 2024
1 parent b1cfea5 commit 002b939
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/cat/mad_hatter/decorators/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def _make_endpoint(endpoint):
)

cls.cheshire_cat_api.include_router(plugins_router, prefix=prefix)
cls.cheshire_cat_api.openapi_schema = None # Flush the cache of openapi schema

return custom_endpoint

Expand Down

0 comments on commit 002b939

Please sign in to comment.