swag icon indicating copy to clipboard operation
swag copied to clipboard

v3.1 name of struct with package name.

Open bikain opened this issue 10 months ago • 1 comments

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.

bikain avatar Feb 19 '25 10:02 bikain

i have a same issue 😢

myjinjin avatar Feb 27 '25 01:02 myjinjin