-
Notifications
You must be signed in to change notification settings - Fork 68
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
feat(gen): Generate single type for a parameter definition #1177
Comments
Having a dedicated schema definition that is referenced there is a workaround for this problem. I'm just sure why a separate definition is required in this case. |
This would significantly reduce the size of my generated source files and improve debuggability since I reuse a lot of my parameters over many endpoints. Although I'm not 100% sure how much inlining the Go compiler does, it may even noticeably reduce the binary size which is something I wanted to explore contributing to ogen when I have time. Parameter reuse was my first idea when looking into the generated code. |
Description
Given the following definition:
The generator creates a separate type for this definition whenever this parameter is used. If two operations (oper1, oper2) use this parameter, there will be two generated types (Oper1PathParam, Oper2PathParam). This makes it very difficult to handle such parameters in a common middleware, since they cannot be converted to a string, as that is just an underlying type.
The text was updated successfully, but these errors were encountered: