0
0
FastAPIframework~10 mins

OpenAPI schema customization in FastAPI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set a custom title for the OpenAPI schema in FastAPI.

FastAPI
from fastapi import FastAPI
app = FastAPI(title=[1])
Drag options to blanks, or click blank then click option'
A"My API"
B'My API'
CMy API
Dtitle="My API"
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around the title string.
Passing the title without quotes causing a syntax error.
2fill in blank
medium

Complete the code to add a description to the OpenAPI schema in FastAPI.

FastAPI
app = FastAPI(description=[1])
Drag options to blanks, or click blank then click option'
A"API description here"
Bdescription="API description here"
C'API description here'
DAPI description here
Attempts:
3 left
💡 Hint
Common Mistakes
Passing description without quotes causing errors.
Using the parameter name inside the value.
3fill in blank
hard

Fix the error in the code to set the OpenAPI version in FastAPI.

FastAPI
app = FastAPI(openapi_version=[1])
Drag options to blanks, or click blank then click option'
A'3.0.0'
B"3.0.0"
C3.0.0
D3.0
Attempts:
3 left
💡 Hint
Common Mistakes
Passing version as a number without quotes.
Using incomplete version strings.
4fill in blank
hard

Fill both blanks to customize the OpenAPI schema with a title and version.

FastAPI
app = FastAPI(title=[1], openapi_version=[2])
Drag options to blanks, or click blank then click option'
A"Custom API"
B"2.0.0"
C'2.0.0'
D'Custom API'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing quotes or missing quotes for either parameter.
Using numbers without quotes for version.
5fill in blank
hard

Fill all three blanks to set title, description, and version in FastAPI OpenAPI schema.

FastAPI
app = FastAPI(title=[1], description=[2], openapi_version=[3])
Drag options to blanks, or click blank then click option'
A"My API"
B"This is my API description."
C"3.0.1"
D'3.0.1'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes on any parameter.
Using single quotes inconsistently.