-
Notifications
You must be signed in to change notification settings - Fork 807
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
Generate a type for nested struct in respond instead of anonymous struct #1139
Comments
I'm having a similar problem. I'm consuming an API that has defined error objects inline, as opposed to references to separate schemas. This causes oapi to generate anonymous structs for the error objects, which makes it difficult to get at that data. The workaround has so far been to change the input YAML file, but that makes it much harder to integrate changes from the producer of the API. |
See also #648 - this is unfortunately one of the issues that @deepmap-marcinr and I have seen as a problem that plagues a lot of folks. When it was originally built, there was an assumption that everyone would control their specs, but that's not always the case. May be fixed before long, but in the meantime if you're able to move the types into the |
Any update on this ability? |
I can try and have a look in the new year, but I've unfortunately got a lot of triaging to do first that'd take priority. If it's high priority for you, I have a GitHub Sponsors option to prioritise the fix - happy to chat more about that if it's of interest |
1. What version are you using?
2. OpenAPI 3 spec:
3. Cmd arguments
4. oapi-codegen config
5. Expected behavior
6. Actual behavior
With actual behavior there are only two ways to set data:
But I want to do like this
I saw issues and some fixes, but they don't seem to solve my problem.
The text was updated successfully, but these errors were encountered: