[FEATURE] Easy way to enable/disable endpoint
See original GitHub issueIs your feature request related to a problem? Please describe.
This is not a problem but rather something that occurs quite commonly. Sometimes you just want to expose a certain endpoint based on configuration settings or environment. Currently there is include_in_schema flag that hides the endpoint in OpenAPI schema but the actual endpoint is still present and responsive. There should be a way to disable endpoint entirely from being exposed.
Describe the solution you’d like
I think there should be a disabled or enabled flag on APIRoute.api_route method to easily enable the endpoint and not exposing it at all.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Enable and disable endpoints at runtime with Spring boot
You can either use @ConditionalOnExpression or @ConditionalOnProperty @RestController @ConditionalOnExpression("${my.property:false}") ...
Read more >How to disable or enable the REST API endpoint in Yoast SEO
1. When you're logged in, you will be in your 'Dashboard'. 2. On the left-hand side, you will see a menu. In that...
Read more >Disable API Gateway default endpoint API - Amazon AWS
Open the API Gateway console. · In the navigation pane, choose APIs, and then choose your REST API. · In the navigation pane,...
Read more >Manage network policies for private endpoints - Microsoft Learn
Disable network policy · Sign-in to the Azure portal. · In the search box at the top of the portal, enter Virtual network....
Read more >Enabling and Disabling Services - Google Cloud
For most operational use cases, the simplest way to enable and disable services is to use Google Cloud console. If you need to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@LKay If you want to exclude based on a boolean flag, is there a reason you couldn’t just put the route definition inside a conditional block, conditioning on the condition you’d pass as
enabledordisabledanyway? It seems to me even if the flag you are requesting was added, the following would be equivalent:The benefit to the first approach would be that it wouldn’t require a new keyword argument on all of the route decorators (and there are already so many!).
Is there something this approach wouldn’t handle?
Handled using wrapping
ifstatements around routes.