Skip to content

Generation panic on custom string #2114

@nesty156

Description

@nesty156

Describe the bug
When running the swag v2 with this flags: swag init -v3.1 --parseDependency --parseInternal --parseDepth 1 -g main.go I get panic because of custom string

type ThreatType string

const (
	MALWARE               ThreatType = "MALWARE"
	SPYWARE               ThreatType = "SPYWARE"
)

type Threat struct {
	ThreatType ThreatType `json:"threatType" form:"threatType"`
}

To Reproduce
Steps to reproduce the behavior:

  1. Install swag v2
  2. Run the docs generation: swag init -v3.1 --parseDependency --parseInternal --parseDepth 1 -g main.go

Expected behavior
No panic :)

Screenshots
If applicable, add screenshots to help explain your problem.

Your swag version
e.g. 2.0.0

Your go version
e.g. 1.25.0

Desktop (please complete the following information):

  • OS: macOS 15.7.2

Additional context
This issue #2078 has the same problem

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