Skip to content

how to response different field of response struct by different routes? #2629

@youthy

Description

@youthy

Problem statement

how to response different field of response struct by different routes?

type Envelope struct {
   Field1 Object1 
   Field2. Object2
}

// Get swagger:route GET /Field1s
// Get Fields2
// Responses:
//   200: body:Envelope
func handler1() {
}

// Get swagger:route GET /Field2s
// Get Field2s
// Responses:
//   200: body:Envelope
func handler2() {
}

all of my handlers return Envelope struct as response body
but use specific field
in route2 I don't want Field1 in response or Field1 = null is ok
how to do this? thanks

Swagger specification

Steps to reproduce

Environment

swagger version: 0.27.0
go version: 1.13.1
OS: macos

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