-
Notifications
You must be signed in to change notification settings - Fork 203
Incorrect Descriptions are generated for an Aliased Type defined in multiple API versions #292
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
Comments
/sig api-machinery |
I root caused this to gengo overwriting the parsed CommentLines from the actual Type when processing an aliased Type later with a different description: Line 491 in 1244d31
The following line overwrites the comments corresponding when it encounters an aliased type with a different comment:
Not sure why the generation of Type descriptions is non-deterministic though (gengo produces descriptions from v1 sometimes and from v1alpha2 otherwise) when |
So this is a result of calling
This fixed it for me:
|
Thanks for reporting the issue. Feel free to open the PR for the fix you proposed. |
I am unable to repro this using a unit test within the repo. Hard to tell why the aliased types are not parsed as |
I am able to repro this with a test, so I'll open a PR. |
Cool! I believe the inconsistent comments attached is due to the recursive call of the Lines 513 to 518 in 1244d31
|
FYI, I'm able to reproduce on my end, PTAL yongruilin@d83797a in case you need it. |
/assign @shashankram |
Fixes the comment parsing on a Type so that it does not get overwritten by an aliased Type with a different comment. Resolves kubernetes#292 Signed-off-by: Shashank Ram <[email protected]>
Fixes the comment parsing on a Type so that it does not get overwritten by an aliased Type with a different comment. Resolves kubernetes#292 Signed-off-by: Shashank Ram <[email protected]> Signed-off-by: Shashank Ram <[email protected]>
Fixes the comment parsing on a Type so that it does not get overwritten by an aliased Type with a different comment. Resolves kubernetes#292 Signed-off-by: Shashank Ram <[email protected]>
Thanks. #294 fixes this |
gengo
produces flaking descriptions for the same type that is defined in multiple pkgs (using an alias), when used with openapi-gen (from kube-openapi).In v1alpha2:
In v1:
The following command generates different Descriptions for the same type in
zz_generated.openapi.go
:The diff:
The description being generated switches between the descriptions defined in the v1 and v1alph2 versions of the API. I am not sure if this is a bug in openapi-gen or gengo.
The text was updated successfully, but these errors were encountered: