Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@milanvthakor
Copy link
Contributor

Describe the PR
This PR handles the issue with the default tag in the struct field. The tool ignores the empty string value for the default tag while generating the swagger specification.

The reason behind it is how the value for the default tag is being read. The code was using the tag.Get() method. This method could return an empty string in two cases: the value itself is an empty string, or the tag doesn't exist at all. And the condition below doesn't handle the first case correctly.

I have changed it to use the tag.Lookup() method to distinguish between the two cases and changed the condition accordingly.

Relation issue
#2052

@sdghchj sdghchj merged commit 77771f0 into swaggo:master Aug 4, 2025
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.

2 participants