fastapi
fastapi copied to clipboard
Integrate with external validators
First check
- [x] I added a very descriptive title to this issue.
- [x] I used the GitHub search to find a similar issue and didn't find it.
- [x] I searched the FastAPI documentation, with the integrated search.
- [x] I already searched in Google "How to X in FastAPI" and didn't find any information.
- [x] I already read and followed all the tutorial in the docs and didn't find an answer.
- [x] I already checked if it is not related to FastAPI but to Pydantic.
- [x] I already checked if it is not related to FastAPI but to Swagger UI.
- [x] I already checked if it is not related to FastAPI but to ReDoc.
- [x] After submitting this, I commit to:
- Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
- Or, I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.
- Implement a Pull Request for a confirmed bug.
Description
Currently, there is only one package that can be used for validation and (de)-serialization. Having the possibility to choose one's validator library would strenghten the micro-framework part of FastAPI and bolster faster and innovative projects (I'm thinking of apischema, but there could be others). Currently, the approach of having to build another framework such as Flama to simply be able to use another validator does not make sense to me.
The solution you would like
Have an interface in FastAPI for the validation / deser so that external (non-default) validators such as marshmallow, apischema, etc. could be plugged in.
I would like to contribute on implementing this
We would be very interested in this as we use apischema a lot. @tiangolo does this align with your goals for FastAPI? Would you accept a PR adding a plugin mechanism for external validators?
We would also be interested in this, especially the ability to integrate with apischema.
My own performance testing between typedload, apischema and pydantic looks like this: https://ltworf.github.io/typedload/performance.html