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

feat: ignore uri tag with gin #1315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

weilence
Copy link

@weilence weilence commented Sep 3, 2022

Describe the PR
ignore uri tag with gin

Relation issue
#1302

Additional context
.

@codecov
Copy link

codecov bot commented Sep 3, 2022

Codecov Report

Base: 85.16% // Head: 85.14% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (45cb88a) compared to base (dfce6c8).
Patch coverage: 75.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1315      +/-   ##
==========================================
- Coverage   85.16%   85.14%   -0.03%     
==========================================
  Files          19       19              
  Lines        3613     3621       +8     
==========================================
+ Hits         3077     3083       +6     
- Misses        458      459       +1     
- Partials       78       79       +1     
Impacted Files Coverage Δ
field_parser.go 96.94% <70.00%> (-0.50%) ⬇️
parser.go 94.55% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

field_parser.go Outdated
@@ -21,6 +21,7 @@ const (
optionalLabel = "optional"
swaggerTypeTag = "swaggertype"
swaggerIgnoreTag = "swaggerignore"
uriTag = "uri"
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest the parameter name should be ignoreTags and should accept a comma-separated list of tags.

var ignoreTagArray = strings.Split(ignoreTags, ",")

func isIgnore(tag reflect.StructTag) bool {
ignoreTag, ok := tag.Lookup(swaggerIgnoreTag)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add unit tests to cover this function.

@@ -20,6 +20,7 @@ const (
optionalLabel = "optional"
swaggerTypeTag = "swaggertype"
swaggerIgnoreTag = "swaggerignore"
ignoreTags = "uri"
Copy link
Contributor

Choose a reason for hiding this comment

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

The ignoredTags should be declared as a swagParam not as constant

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

2 participants