Enable "Try it out" in OpenAPI so that no need to click

Question:

I’m using FastAPI and OpenAPI/Swagger UI to see and test my endpoints.

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?

Asked By: Riya

||

Answers:

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 can update that way can be found here.

For your example, it would look like this:

from fastapi import FastAPI

app = FastAPI(swagger_ui_parameters={"tryItOutEnabled": True})
Answered By: Arne