Skip to content

Broken swagger:response Generation with Go 1.22.0 + 1.21.5 darwin/arm64 #3071

@kvizdos

Description

@kvizdos

Problem statement

I've been trying to get Swagger running for a few hours now. I can't seem to get responses working at all. Using code directly from the example page (https://goswagger.io/use/spec/response.html):

// A ValidationError is an error that is used when the required input fails validation.
// swagger:response validationError
type ValidationError struct {
    // The error message
    // in: body
    Body struct {
        // The validation message
        //
        // Required: true
        // Example: Expected type int
        Message string
        // An optional field name to which this validation applies
        FieldName string
    }
}

And building with swagger generate spec -o ./swagger.yaml (also tried swagger generate spec -o ./swagger.yaml --scan-models), I get this output:

responses:
    validationError:
        description: A ValidationError is an error that is used when the required input fails validation.

No amount of anything seems to fix this from what I've tried.

Any help would be greatly appreciated!

Environment

swagger version: v0.30.5 (I've tried static builds + homebrew)
go version: 1.22.0 + 1.21.5
OS: darwin/arm64

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