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

Use early overrides to allow converting unsupported types. #1209

Merged
merged 12 commits into from Jun 17, 2022
Merged

Use early overrides to allow converting unsupported types. #1209

merged 12 commits into from Jun 17, 2022

Conversation

smatric
Copy link
Contributor

@smatric smatric commented May 20, 2022

Describe the PR
Convert types using overrides before other checks are made. This makes it possible, for example, to replace all occurrences of sql.NullString with string. Without this feature, every field of unsupported type has to be tagged with swaggertype in parameter structs.

Relation issue
#1208

mateusz added 2 commits May 20, 2022 00:01
- Convert types using overrides before other checks are made. This makes it possible, for example, to replace all occurrences of sql.NullString with string.
- Include an example with .swaggo rules.
@codecov
Copy link

codecov bot commented May 20, 2022

Codecov Report

Merging #1209 (9d035e9) into master (a780e45) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

❗ Current head 9d035e9 differs from pull request most recent head a3c0947. Consider uploading reports for the commit a3c0947 to get more accurate results

@@            Coverage Diff             @@
##           master    #1209      +/-   ##
==========================================
- Coverage   94.90%   94.83%   -0.08%     
==========================================
  Files          14       14              
  Lines        2611     2614       +3     
==========================================
+ Hits         2478     2479       +1     
- Misses         73       74       +1     
- Partials       60       61       +1     
Impacted Files Coverage Δ
parser.go 93.59% <100.00%> (+0.02%) ⬆️
packages.go 87.30% <0.00%> (-1.06%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a780e45...a3c0947. Read the comment docs.

@ubogdan
Copy link
Contributor

ubogdan commented May 20, 2022

@smatric Good job. Would you mind writing unit tests to cover new code?

parser.go#L902-L903
Added lines #L902 - L903 were not covered by tests

@smatric
Copy link
Contributor Author

smatric commented May 25, 2022

Hi @ubogdan,
I added two tests that run getTypeSchema method with different parameters. One for defined and another for undefined overrides. Please see if they meet the standard.

ubogdan
ubogdan previously approved these changes Jun 16, 2022
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
Copy link
Contributor

ubogdan commented Jun 16, 2022

Please fix the conflict in parser.go.

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 0e2ec6c into swaggo:master Jun 17, 2022
@ubogdan
Copy link
Contributor

ubogdan commented Jun 17, 2022

@smatric Thanks for your contribution.

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.

None yet

6 participants