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

@name doesn't work #1909

Open
tonidy opened this issue Oct 21, 2024 · 3 comments
Open

@name doesn't work #1909

tonidy opened this issue Oct 21, 2024 · 3 comments
Labels

Comments

@tonidy
Copy link

tonidy commented Oct 21, 2024

Describe the bug
When I upgraded swag from 1.16.3 to 1.16.4, I noticed the renaming model to display (@name) didn't work in my struct:

type CardResponse struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
} // @name CardResponseV2

Expected behavior

@name should be working

Screenshots

N/A

Your swag version
swag version v1.16.4

Your go version
go version go1.23.2 darwin/arm64

Desktop (please complete the following information):

  • OS: [e.g. iOS] macOS
  • Browser: [e.g. chrome, safari]
  • Version: [e.g. 22]

Additional context
Add any other context about the problem here.

@njacob1001
Copy link

njacob1001 commented Oct 23, 2024

Same issue,

type UIElement struct {
	Id          string            `json:"id"`
	UIElement    []UIElement   `json:"UIElement"`
	Title       string            `json:"title"`
} // @name UIElement

the output is

{
"internal_form_infrastructure_web_dto.UIElement": {
            "type": "object",
            "properties": {
                "UIElement": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/internal_form_infrastructure_web_dto.UIElement"
                    }
                },
                "id": {
                    "type": "string"
                },
                "title": {
                    "type": "string"
                }
            }
        }
}

@ubogdan ubogdan added the bug label Oct 24, 2024
@YlanzinhoY
Copy link

What should the correct output look like?

@tonidy
Copy link
Author

tonidy commented Nov 19, 2024

@YlanzinhoY with this struct:

type UpdateGameConfigRequest struct {
	GameConfig model.GameConfig `json:"gameConfig" validate:"required"`
} // @name UpdateGameConfigRequest

Here is when I run my code with swag 1.6.4:

image

The correct output should be dto.UpdateGameConfigRequest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants