parvez3019 / go-swagger3

Swagger 3.0 implementation for go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to add oneOf to the schema

yeshwanthPentakota opened this issue · comments

type Response struct {
field1 *string json:"field1,omitempty"
field2 *string json:"field2,omitempty"
}

I want to indicate that the response will either contain field1 or field2

Sample spec:

    Response:
      oneOf:
        - $ref: '#/components/schemas/Response1'
        - $ref: '#/components/schemas/Response2'