Home > front end >  Enable "Try it out" in OpenAPI so that no need to click
Enable "Try it out" in OpenAPI so that no need to click

Time:01-05

I'm using FastAPI and see my endpoints using OpenAPI (former Swagger).

Each time I use an endpoint for the first time, in order to test it, I have to first click the Try it out button, which is getting tedious.

Is there a way to make it disappear and be able to test the endpoint instantly?

CodePudding user response:

Yes, you can configure the OpenAPI/swagger page by passing a dictionary to the kwarg "swagger_ui_parameters" when creating your FastAPI instance (docs). The full list of all settings you could update through that dict can be found here.

For your example, it would look like this:

from fastapi import FastAPI

app = FastAPI(swagger_ui_parameters={"tryItOutEnabled": True})
  • Related