This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
FastAPI uses pydantic models to validate the API request body and also generate the swagger documentation. Since the schema | |
generated by pydantic only comply to JSON schema specification and not to openAPI specification, swagger documentation | |
generated from pydantic models do not support adding multiple examples for a request body. | |
Ref: https://fastapi.tiangolo.com/tutorial/schema-extra-example/#technical-details | |
In the following code, I have extended fastAPI openAPI schema to include multiple request body examples. | |
""" | |
import json |