Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: parse only specific extension tag (#1219)
* feat: parse only specific extension tag * chore: add tests * fix: Exclude operation before it's parsed Previous implementation had an issue where it was excluding operation after schema and other parts were parsed. That caused schema definition to be included in the output file, even though operation didn't match the extension. New implementation won't even start processing operation if extension isn't matching. Only potential issue/problem I see with this approach is that we are duplicating logic for comment line parsing (I basically c/p it from other places) but not sure how big of an issue that actually is as I noticed we are doing that at other places as well. * fix: detaching matchExtension from parser as per PR review suggestions
- Loading branch information
Showing
5 changed files
with
99 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package main | ||
|
||
// @Router /without-extension [get] | ||
func Fun() {} | ||
|
||
// @Router /with-another-extension [get] | ||
// @x-another-extension {"address": "http://backend"} | ||
func Fun2() {} | ||
|
||
// @Router /with-correct-extension [get] | ||
// @x-google-backend {"address": "http://backend"} | ||
func Fun3() {} |