Skip to content

v2: can't parse numeric value of "maximum" tag #2153

@thokuest

Description

@thokuest

Describe the bug
Parsing a struct with a float64 field having a floating point minimum/maximum value fails with message:

Error parsing type definition 'CreateInput': can't parse numeric value of "maximum" tag: strconv.Atoi: parsing "0.1": invalid syntax

To Reproduce

type CreateInput struct {
	Factor *float64 `json:"factor" validate:"required" minimum:"0" maximum:"0.1" example:"0.04"`
}

// @Summary      Create Something
// @Accept       json
// @Produce      json
// @Param        Payload   body   CreateInput true "Request Body"
// @Router       /something/create [post]
func Create() {}

Expected behavior
No error is generated and proper OpenAPI v3 model is generated.

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

Your swag version
v2.0.0

Your go version
1.25.8

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: n.a.
  • Version: 26.3.1

Additional context

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