-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add operationId uniqueness check #732
Add operationId uniqueness check #732
Conversation
Codecov Report
@@ Coverage Diff @@
## master #732 +/- ##
==========================================
+ Coverage 81.50% 83.65% +2.14%
==========================================
Files 8 7 -1
Lines 1665 1835 +170
==========================================
+ Hits 1357 1535 +178
+ Misses 195 189 -6
+ Partials 113 111 -2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in function.
however, operationsIds is better to be in a local scope.
@sdghchj I tried to move it inside the |
That's it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@idexter Thanks for your contributions. |
Describe the PR
Add
operationId
uniqueness check, in accordance with OpenAPI v2 SpecificationRelation issue
Closes #731
Additional context
I added a uniqueness check after the parsing phase, so it shows a path when an error happens (E.g.
GET /foo/bar
) but did not show the file where duplication happens.I did that in this way because I did not succeed adding check inside
ParseRouterAPIInfo()
. The reason I did not succeed is that because when you are going through this range:swag/parser.go
Lines 171 to 175 in 67cb097
parser.files
can contain the same file twice. Once with absolute path and once with a relative path. So in some situations, errors happens even if there are no duplications inoperationId