Due to the reserved words in python and pydantic, the following fields are used with alias feature provided by pydantic:
| Class | Field name in the class | Alias (as in OpenAPI spec) |
|---|---|---|
| Header* | param_in | in |
| MediaType | media_type_schema | schema |
| Parameter | param_in | in |
| Parameter | param_schema | schema |
| PathItem | ref | $ref |
| Reference | ref | $ref |
| SecurityScheme | security_scheme_in | in |
| Schema | schema_format | format |
| Schema | schema_not | not |
The "in" field in Header object is actually a constant (
{"in": "header"}).
For convenience of object creation, the classes mentioned in above has configured
allow_population_by_field_name=True.Reference: Pydantic's Model Config
Due to the constriants of python typing structure (not able to handle dynamic field names),
the following schema classes are actually just a typing of Dict:
| Schema Type | Implementation |
|---|---|
| Callback | Callback = Dict[str, PathItem] |
| Paths | Paths = Dict[str, PathItem] |
| Responses | Responses = Dict[str, Union[Response, Reference]] |
| SecurityRequirement | SecurityRequirement = Dict[str, List[str]] |
On creating such schema instances, please use python's dict type instead to instantiate.