Skip to content

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

Open
@bikain

Description

@bikain

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions