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

fix: Go generics cannot find common package object type definition #1281

Merged
merged 3 commits into from
Aug 9, 2022

Conversation

FabianMartin
Copy link
Contributor

@FabianMartin FabianMartin commented Aug 4, 2022

Describe the PR
PR fixes the issues described in #1237 and #1253
Additionally, it reduces the generated doc size, cause it creates refs to types instead of embedding the fields

Relation issue
#1237
#1253

Additional context
All changes are backward compatible and have been tested with Go 1.15, 1.16, 1.17, 1.18 and 1.19.

- use ast.SelectorExpr instead if ast.Ident to embed types
- tests reworked

fixes swaggo#1237
@codecov
Copy link

codecov bot commented Aug 4, 2022

Codecov Report

Merging #1281 (4c26143) into master (2f148dd) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1281      +/-   ##
==========================================
+ Coverage   94.95%   94.97%   +0.01%     
==========================================
  Files          14       14              
  Lines        2717     2726       +9     
==========================================
+ Hits         2580     2589       +9     
  Misses         78       78              
  Partials       59       59              
Impacted Files Coverage Δ
generics.go 94.61% <100.00%> (+0.30%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us.

- Generate full type name, if only one generic field exists
- Generate refs to generic properties
- Tests extended to test override behavior

refs swaggo#1237
fixes swaggo#1253
Copy link
Contributor

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ubogdan ubogdan merged commit af1c525 into swaggo:master Aug 9, 2022
@ubogdan
Copy link
Contributor

ubogdan commented Aug 9, 2022

@FabianMartin Thanks for your contribution.

@FabianMartin FabianMartin deleted the generics_refs branch August 9, 2022 14:52
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 this pull request may close these issues.

2 participants