by rrgok · 2y ago · 0 comments
Something I'm missing from all these automatic API generation frameworks from schema is having different complex data validation rules for creating, updating and eventually deleting. It is nice to put simple data type constraints on fields, but is infinitely more useful to have a DSL that can express complex logic: field X cannot be Z when field Y and W have value V and U respectively. Or when mass inserting/updating validating that the aggregate of input field Z is greater than X or the aggregate is not already in DB. Same thing for relationship.
Laravel validation rules is the closest that comes to this kind of input validation, but Laravel doesn't provide automatic API generation.
At the same time, there's an ecosystem beyond just the web framework, where rapid iteration is helping a developer write once but leverage multiple tools.
For instance:
- FastAPI
- Starlette
- pydantic
- sqlmodel
- postgres
Here's an example discussion for building the full stack yourself: https://medium.com/@lawsontaylor/the-ultimate-fastapi-projec...The value comes from the sort of community-agreed data model:
Why: https://docs.pydantic.dev/latest/why/
Datamodel code gen: https://docs.pydantic.dev/latest/integrations/datamodel_code...
With this at the core, then API contract, doc, DB, test, and SDK generation are at hand, not to mention easier integration with all of these other projects. And now with
Observability: https://pydantic.dev/logfire
I find no hits on the terms `pydantic` or `openapi` in your docs. Given your choice to include Python as one of the three supported languages, do you have a plan to tie into Pydantic or implement a bridge?
The logfire is pretty cool and in the future, it will be implemented in Teo's way.
To be more clear, it's great you have a similar option for each of these, but having things similar to them isn't the same as having the actually same model that everything else in the ecosystem understands and plays well with.
Or, are you saying, under the hood, you're using literally the same? The docs make it sound as though you're reinventing all these wheels (pardon the Python pun).