-
Notifications
You must be signed in to change notification settings - Fork 54
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
Use tag to determine if to flatten or not an embedded anonymous field #85
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I would just like a few changes to the tests. Thanks
openapi/generator_test.go
Outdated
@@ -48,6 +48,7 @@ type ( | |||
*u | |||
uu *u // ignored, unexported field | |||
q // ignored, embedded field of non-struct type | |||
*Q `json:"data"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add another field that is an exported field of struct type, but that has no tag? To test that its fiels are then inlined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could you keep the tag value to Q
to match the current output, where each field is named by its type in the final spec.
@@ -70,6 +70,9 @@ | |||
"S": { | |||
"type": "integer", | |||
"format": "int32" | |||
}, | |||
"data": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/data/Q
@wI2L thanks for the review, fixed the issues. |
Codecov Report
@@ Coverage Diff @@
## master #85 +/- ##
==========================================
+ Coverage 94.34% 94.35% +0.01%
==========================================
Files 7 7
Lines 973 975 +2
==========================================
+ Hits 918 920 +2
Misses 39 39
Partials 16 16
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Thank you 👍 |
If we would take for example a kube object Pod it has
ObjectMeta
as an embedded field but if we render it viajson.Marshal
we would get a nicemetadata
field in our json.However in our OpenAPI definition this field would be missing.