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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
added security definition description #1174
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d07b87b
added security definition description
pmorelli92 607ae63
unexported functions
pmorelli92 e8fe7c1
removed test generated file
pmorelli92 e7c7e2f
code format and readme
pmorelli92 f73b609
removed test generated file
pmorelli92 2a6b9a3
renamed sec.def to security.definition
pmorelli92 cad3127
support for description on security definition
pmorelli92 ee9d582
added tryAddDescription tests
pmorelli92 c1a4f7d
fixed typo
pmorelli92 36d1424
added another test case scenario
pmorelli92 a117495
added test for multiple security definitions
pmorelli92 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please update sec.def.description with "description" for the parameter column and add also the "description" feature in the example column.
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.
I added the example on the table below where the
parameter annotation | example
lives as I cannot do line breaks on the example cell of the mentioned table. Hope that is ok.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.
@ubogdan , as
sec.def.description
is a "line" parameter such asheader
,in
,scopes
etc; I had to name it in the mentioned way because if I named itdescription
it will override (or take) the description at the general API info level.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.
I can of course change it to
x-description
as well as an alternative :)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.
See the following definition
swag/example/celler/main.go
Lines 31 to 56 in 050b0aa
I expect to see something like
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.
I can do that :)
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.
You made it @security.definition.description instead of @description ...
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.
Sorry, did not see your edited comment 馃槄
I will try to make it work with just
description
but as I said before, when I tried it overlapped with the@description
that you put to the general API info. I will debug and see if I can solve that.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.
The current way it works is the following, given these lines:
The code will:
this API is a demo
comments[i+1:]
in other words skipping the current. This will effectively go through the@description
and set it correctly.Perform OAUTH2 at application level
The issue is that the
parseSecAttr
function is iterating all the lines below until it finds another@securitydefinitions.
. But then, the lines thatparseSecAttr
iterated, will be iterated back again by the main for buckle.This is why I changed the name to something different. I can potentially see how to make the main buckle not go through the lines that the security definition already did, but that might introduce lots of changes.
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.
@ubogdan check it now, with the changes I have done it is working correctly and the main buckle does not re-iterate the lines that the security definitions already iterated :)