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

Default required #1181

Merged
merged 7 commits into from Jun 16, 2022
Merged

Default required #1181

merged 7 commits into from Jun 16, 2022

Conversation

underbek
Copy link
Contributor

Describe the PR
Added new option (defaultRequired) for swag init

Additional context
I ran into a problem that I have to put validate required next to each field. This is not very convenient when a lot of code has already been written and you have to add the same thing to the tags for each field. I decided that this option will help not only me, but also the community.
Also added the ability to add validate optional fields.
Please merge it)

mikhaylovv
mikhaylovv previously approved these changes Apr 18, 2022
@codecov
Copy link

codecov bot commented Apr 19, 2022

Codecov Report

Merging #1181 (a59bb68) into master (67cb768) will increase coverage by 0.01%.
The diff coverage is 100.00%.

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

@@            Coverage Diff             @@
##           master    #1181      +/-   ##
==========================================
+ Coverage   94.96%   94.97%   +0.01%     
==========================================
  Files          12       12              
  Lines        2520     2527       +7     
==========================================
+ Hits         2393     2400       +7     
  Misses         69       69              
  Partials       58       58              
Impacted Files Coverage Δ
parser.go 93.56% <ø> (ø)
field_parser.go 98.57% <100.00%> (+0.02%) ⬆️
gen/gen.go 93.36% <100.00%> (+0.03%) ⬆️

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 67cb768...c65a4a2. Read the comment docs.

ubogdan
ubogdan previously approved these changes Apr 19, 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

cmd/swag/main.go Outdated
@@ -26,6 +26,7 @@ const (
codeExampleFilesFlag = "codeExampleFiles"
parseInternalFlag = "parseInternal"
generatedTimeFlag = "generatedTime"
defaultRequiredFlag = "defaultRequired"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think "requiredByDefault" sounds better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@ubogdan
Copy link
Contributor

ubogdan commented Apr 19, 2022

@AndreyAndreevich I don't like the idea to have a switch that will turn all the generated documentation upside down, but it may be useful to lazy developers.
Please open an issue describing this feature so we can have evidence of this implementation.

@ubogdan
Copy link
Contributor

ubogdan commented May 20, 2022

@AndreyAndreevich we can't merge this due to conflicts.

@underbek underbek dismissed stale reviews from ubogdan and mikhaylovv via 95dd05f June 12, 2022 16:37
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 a780e45 into swaggo:master Jun 16, 2022
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

3 participants