Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around the title string.
Passing the title without quotes causing a syntax error.
✗ Incorrect
The title parameter expects a string, so it must be enclosed in quotes.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing description without quotes causing errors.
Using the parameter name inside the value.
✗ Incorrect
The description must be a string literal, so it needs quotes.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing version as a number without quotes.
Using incomplete version strings.
✗ Incorrect
The openapi_version must be a string, so it needs quotes around the version number.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing quotes or missing quotes for either parameter.
Using numbers without quotes for version.
✗ Incorrect
Both title and openapi_version require string values with quotes.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes on any parameter.
Using single quotes inconsistently.
✗ Incorrect
All three parameters require string values enclosed in quotes.