Open drnextgis opened 5 months ago
Hi. Do you have any thoughts on how this could be implemented?
there are two things:
for POST request we use pydantic models, those models do not have specific configuration, so by default they will accept extra
(https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra). You can fix
that by creating your own model and set model_config={"extra": "forbid:}
for GET request, this is a bit more tricky and I don't think there is something at FastAPI level to error
on additional query parameter: https://github.com/tiangolo/fastapi/discussions/7697#discussioncomment-5143342
An extension can be disabled, and this is reflected in the
conformsTo
section. However, if a client utilizes the syntax of a disabled extension (e.g.,query
) in a request, it would be helpful to have a mechanism on the server side to detect this and raise an exception. Currently, it merely ignores such requests, leaving the client unaware of why the results do not match the submitted query.