New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code-generation of type hints and handler interfaces #376
Comments
@p1c2u Since you've been quite active again recently, I've been wondering about your opinion on this topic. 🙂 I've noticed your 👍 reaction to this vague idea. Would you (and of course also others) be interested in pursuing this idea more concretely, and would you have the capacity to discuss a concrete proposal? |
Hi @sisp |
I'm working on something like this in Lapidary. It's not a trivial problem, here's an article why: It's written mainly from java perspective, and while python class instances are a syntactic sugar over dicts (at least for simple data classes), it still applies to type hints. |
Something still missing in all OpenAPI-first implementations I've seen for Python including
openapi-core
is type-safety w.r.t. the validated request body, URL parameters, and headers.openapi-core
validates this data, but there currently is no way to statically type it except for manually implementing the type hints and manually typing the request handlers. This is brittle and doesn't scale well.I suggest to generate code containing type hints and request handler interfaces for the supported web frameworks similar to
oapi-codegen
(Golang) orfastapi-code-generator
(Python).The details need to be discussed and figured out, of course, but I'd appreciate some feedback first. What do you think?
The text was updated successfully, but these errors were encountered: