Skip to content

v3.1 name of struct with package name. #1982

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

Open
bikain opened this issue Feb 19, 2025 · 1 comment
Open

v3.1 name of struct with package name. #1982

bikain opened this issue Feb 19, 2025 · 1 comment

Comments

@bikain
Copy link

bikain commented Feb 19, 2025

Describe the bug
Hello.
go.code:

type ResponseCreatePayGroup struct {
	GroupID int64 `json:"groupId,omitempty" format:"int64"`
	Pays           []ResponseCreatePay `json:"pays,omitempty"`
	*cheque.Cheque `json:"cheque,omitempty"`
} // @name ResponseCreatePayGroup

If i make swagger at 2.0 version(swag init -g app.go --pd), name of fields use @name:

ResponseCreatePayGroup:
    properties:
      cheque:
        $ref: '#/definitions/Cheque'
      groupId:
        format: int64
        type: integer
      pays:
        items:
          $ref: '#/definitions/ResponseCreatePay'
        type: array
    type: object

If i make swagger with flat --3.1(swag init -g app.go --pd --v3.1):

 createpays.ResponseCreatePayGroup:
      properties:
        cheque:
          $ref: '#/components/schemas/cheque.Cheque'
        groupId:
          format: int64
          type: integer
        pays:
          items:
            $ref: '#/components/schemas/createpays.ResponseCreatePay'
          type: array
          uniqueItems: false
      type: object

Can i use @name in v3.1? What i need make for use @name in v3.1?

To Reproduce
Steps to reproduce the behavior:

  1. add in file testdata/v3/simple/web/handler.go tag @name
  2. make swagger: go run main.go init -d C:\Temp_folder\swag-2.0.0-rc4\testdata\v3\simple\api\ -g api.go --pd --v3.1

Expected behavior
Name of definition(component) and fields without package name.

Your swag version
v2.0.0-rc4

Your go version
1.22.0

Desktop (please complete the following information):

  • OS: windwos
  • Browser: chrome

Additional context
Add any other context about the problem here.

@myjinjin
Copy link

i have a same issue 😢

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

No branches or pull requests

2 participants