Hacker News new | ask | show | jobs
by rrgok 744 days ago
Looks interesting. One suggestion, don't make data validation and authnz an after thought.

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.

1 comments

Hi @rrgok, Teo supports builtin and extendable data validation and authentication rules. The feature is called pipeline. It supports very complicated type inference. See this: https://docs.teodev.io/concepts/components/teo-schema/pipeli...
This is fantastic.

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?

Hi @Terretta, I plan to generate OpenAPI output for HTTP clients like Postman to import and read. We have things like FastAPI, Starlet, pedantic, sqlmodel and Postgres in Teo. The only thing we lack of is the debugger web interface which we could use Postman after exporting OpenAPI output is implemented.

The logfire is pretty cool and in the future, it will be implemented in Teo's way.

Thanks for the reply.

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).

They are similar things. The wheels are reimplemented to suit Teo's architecture.