Repository navigation
Use the structs name without the @name comment - #2043
Merged
Merged
Conversation
Member
|
I remember, package path is introduced into the naming rules to distinguish structs with the same name but from different packages. So if a long name occurs, there are more than one struct with the same name in you project. |
sdghchj
approved these changes
Jul 25, 2025
pborgen
pushed a commit
to pborgen/swag
that referenced
this pull request
Jan 8, 2026
* Fixed struct naming when using dependency parsing * Fixed naming * Fixed debug message always triggering --------- Co-authored-by: skast <stephan.kast@hoss-mobility.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Describe the PR
I have added an extra flag that removes long names from struct definitions when using the
--pdflag.Example:
Struct is in
myProject/internal/database/model/mytest.goStruct's name is
MyTestOutcome without the schema rename of
myProject_internal_database_model.MyTest.Outcome with the schema rename
MyTest.This makes generating code from the swagger JSON way more readable.
Relation issue
e.g. https://github.com/swaggo/swag/pull/118/files
Additional context
Add any other context about the problem here.