You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we handle validation of API params on a HTTP + handler basis, by that I mean that we write validation code specify to every handler method, and we do not have a unified validation method. This means that we reimplement the same things everywhere, which most of the time results in unexpected errors.
OpenAPI core supports validation. We could modify our base handler to convert the docstring to OpenAPI via apispec, and then perform automatic validation on in and output:
Currently, we handle validation of API params on a HTTP + handler basis, by that I mean that we write validation code specify to every handler method, and we do not have a unified validation method. This means that we reimplement the same things everywhere, which most of the time results in unexpected errors.
We could consider using Marshmellow which we use for sqlalchemy and other schemas that are in fact already used for API docs generation by a couple of handlers. A good example is: https://github.com/skyportal/skyportal/blob/c2019aa779e663fdaa21d9857615952ce2f0e8af/skyportal/models/schema.py#L1691, that we then used in https://github.com/skyportal/skyportal/blob/c2019aa779e663fdaa21d9857615952ce2f0e8af/skyportal/handlers/api/spectrum.py#L1038.
We could consider using Marshmallow schemas everywhere
The text was updated successfully, but these errors were encountered: