Closed rambo closed 11 months ago
This avoids nasty bugs down the line (and also incomplete autogenerated openapi schemas)
class MyModel(BaseModel, extra="forbid"): """Model for My X"""
This info should probably be updated to our best_practises repo.
There is also another way that is more compatible with providing examples to the openapi.json, see https://github.com/pvarki/python-rasenmaeher-api/blob/main/src/rasenmaeher_api/web/api/tokens/schema.py
Also all the fields should use the foo: str = Field(description="bar") style for defining the fields since the extended field definition is very useful to the openapi spec generator
foo: str = Field(description="bar")
This avoids nasty bugs down the line (and also incomplete autogenerated openapi schemas)
This info should probably be updated to our best_practises repo.
There is also another way that is more compatible with providing examples to the openapi.json, see https://github.com/pvarki/python-rasenmaeher-api/blob/main/src/rasenmaeher_api/web/api/tokens/schema.py