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

Added suport for parsing comments inside of function bodies #1824

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

j-d-ha
Copy link
Contributor

@j-d-ha j-d-ha commented Jun 9, 2024

Describe the PR
I have updated ParseRouterAPIInfo() to parse API info from comments inside of function bodies if the new CLI flag ParseFuncBody is used.

Relation issue
Implements idea detailed here: #1809

Additional context
This change is opt-in only as the new CLI flag ParseFuncBody must be used to get the new functionality. This will have no impact on existing users.

Jonas Ha added 2 commits May 11, 2024 16:02
- added documentation for --parseFuncBody flag

(changed) main.go
- added --parseFuncBody flag flag

(changed) gen.go
- added ParseFuncBody to  Config struct

(changed) parser_test.go
- added tests for ParseRouterAPIInfo changes to parse comments inside of functions

(changed) parser.go
- added ParseFuncBody to Parser struct
- modified ParseRouterAPIInfo to parse comments from AstFileInfo.File.Comments instead of from AstFileInfo..File.Decls[].Doc.List if parser.ParseFuncBody set to true
- moved logic for comment parsing from ParseRouterAPIInfo to parseRouterAPIInfoComment
- moved fileInfo.ParseFlag & ParseOperations checks to top of function with early return
@sdghchj sdghchj merged commit 7204462 into swaggo:master Jun 21, 2024
10 checks passed
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