Skip to content
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

openapi3gen Panic when embedded field has more properties than root #425

Closed
austince opened this issue Sep 23, 2021 · 2 comments · Fixed by #434
Closed

openapi3gen Panic when embedded field has more properties than root #425

austince opened this issue Sep 23, 2021 · 2 comments · Fixed by #434

Comments

@austince
Copy link

austince commented Sep 23, 2021

When using a SchemaCustomizer with an embedded struct field that has more fields than the root object, the generator panics. It seems like the issue is that the field index is accessed from the parent based on the index of the embedded.

I have a test showing this here: austince@f93a9da

@austince
Copy link
Author

austince commented Sep 23, 2021

This seems to be a problem with how jsoninfo treats Anonymous fields – it seems to just add them as fields to the parent, which is incorrect if the reflected type is used later on for index access. Moreover, it seems that TypeInfo only supports a flat list of fields.

I'll try to spend some time for a solution, though do not know if it will be backwards compatible.

@austince
Copy link
Author

This also makes it impossible to generate a schema ref for the openapi3.T{} type itself, unless I'm missing something.

@fenollp fenollp linked a pull request Oct 7, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant