Skip to content

Work around for name collisions? #2792

@affanshahid

Description

@affanshahid

Problem statement

If I have two separate structs with the same name but in different packages and they are used inside of other swagger:models the resulting swagger docs seems to cause clashes between the two types and shows properties incorrectly.

Is there a way to change the name that shows up in the generated docs?

Steps to reproduce

Consider the following:

package a

// swagger:model ModelA
type ModelA struct {
    Foo int
    Bar Baz
}

type Baz struct {
    A string
}

// ...
package b

// swagger:model ModelB
type ModelB struct {
    Foo string
    Bar Baz
}

type Baz struct {
    B int
}

ModelA and ModelB themselves show up just fine but the resulting docs only show 1 Baz (however there are actually 2: a.Baz and b.Baz). Since Baz is inside both ModelA and ModelB it will pick one of the two actual definitions and show that

Environment

swagger version: 0.29.0
go version: 18
OS: macOS Monterey 12.1

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