openapi20

package
v0.1.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contact

type Contact struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Contact provides contact information for the API. https://swagger.io/specification/v2/#contact-object

func NewContact

func NewContact(name, url, email string) *Contact

NewContact creates a new Contact instance.

func (*Contact) Email

func (c *Contact) Email() string

func (*Contact) MarshalFields

func (c *Contact) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Contact) MarshalJSON

func (c *Contact) MarshalJSON() ([]byte, error)

func (*Contact) MarshalYAML

func (c *Contact) MarshalYAML() (interface{}, error)

func (*Contact) Name

func (c *Contact) Name() string

func (*Contact) SetEmail

func (c *Contact) SetEmail(email string) error

func (*Contact) SetName

func (c *Contact) SetName(name string) error

func (*Contact) SetURL

func (c *Contact) SetURL(url string) error

func (*Contact) URL

func (c *Contact) URL() string

type ElementBase

type ElementBase = shared.ElementBase

ElementBase is embedded in all v20 types to provide vendor extensions and library metadata.

type ExternalDocs

type ExternalDocs struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

ExternalDocs allows referencing external documentation. https://swagger.io/specification/v2/#external-documentation-object

func NewExternalDocs

func NewExternalDocs(description, url string) *ExternalDocs

NewExternalDocs creates a new ExternalDocs instance.

func (*ExternalDocs) Description

func (ed *ExternalDocs) Description() string

func (*ExternalDocs) MarshalFields

func (ed *ExternalDocs) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*ExternalDocs) MarshalJSON

func (ed *ExternalDocs) MarshalJSON() ([]byte, error)

func (*ExternalDocs) MarshalYAML

func (ed *ExternalDocs) MarshalYAML() (interface{}, error)

func (*ExternalDocs) SetDescription

func (ed *ExternalDocs) SetDescription(description string) error

func (*ExternalDocs) SetURL

func (ed *ExternalDocs) SetURL(url string) error

func (*ExternalDocs) URL

func (ed *ExternalDocs) URL() string
type Header struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Header represents a Header Object in a response. https://swagger.io/specification/v2/#header-object

func NewHeader

func NewHeader(f HeaderFields) *Header

NewHeader creates a new Header instance.

func (*Header) CollectionFormat

func (h *Header) CollectionFormat() string

func (*Header) Default

func (h *Header) Default() interface{}

func (*Header) Description

func (h *Header) Description() string

func (*Header) Enum

func (h *Header) Enum() []interface{}

func (*Header) ExclusiveMaximum

func (h *Header) ExclusiveMaximum() bool

func (*Header) ExclusiveMinimum

func (h *Header) ExclusiveMinimum() bool

func (*Header) Format

func (h *Header) Format() string

func (*Header) Items

func (h *Header) Items() *Items

func (*Header) MarshalFields

func (h *Header) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Header) MarshalJSON

func (h *Header) MarshalJSON() ([]byte, error)

func (*Header) MarshalYAML

func (h *Header) MarshalYAML() (interface{}, error)

func (*Header) MaxItems

func (h *Header) MaxItems() *uint64

func (*Header) MaxLength

func (h *Header) MaxLength() *uint64

func (*Header) Maximum

func (h *Header) Maximum() *float64

func (*Header) MinItems

func (h *Header) MinItems() *uint64

func (*Header) MinLength

func (h *Header) MinLength() *uint64

func (*Header) Minimum

func (h *Header) Minimum() *float64

func (*Header) MultipleOf

func (h *Header) MultipleOf() *float64

func (*Header) Pattern

func (h *Header) Pattern() string

func (*Header) SetCollectionFormat

func (h *Header) SetCollectionFormat(collectionFormat string) error

func (*Header) SetDefault

func (h *Header) SetDefault(defaultVal interface{}) error

func (*Header) SetDescription

func (h *Header) SetDescription(description string) error

func (*Header) SetEnum

func (h *Header) SetEnum(enum []interface{}) error

func (*Header) SetExclusiveMaximum

func (h *Header) SetExclusiveMaximum(exclusiveMaximum bool) error

func (*Header) SetExclusiveMinimum

func (h *Header) SetExclusiveMinimum(exclusiveMinimum bool) error

func (*Header) SetFormat

func (h *Header) SetFormat(format string) error

func (*Header) SetItems

func (h *Header) SetItems(items *Items) error

func (*Header) SetMaxItems

func (h *Header) SetMaxItems(maxItems *uint64) error

func (*Header) SetMaxLength

func (h *Header) SetMaxLength(maxLength *uint64) error

func (*Header) SetMaximum

func (h *Header) SetMaximum(maximum *float64) error

func (*Header) SetMinItems

func (h *Header) SetMinItems(minItems *uint64) error

func (*Header) SetMinLength

func (h *Header) SetMinLength(minLength *uint64) error

func (*Header) SetMinimum

func (h *Header) SetMinimum(minimum *float64) error

func (*Header) SetMultipleOf

func (h *Header) SetMultipleOf(multipleOf *float64) error

func (*Header) SetPattern

func (h *Header) SetPattern(pattern string) error

func (*Header) SetType

func (h *Header) SetType(headerType string) error

func (*Header) SetUniqueItems

func (h *Header) SetUniqueItems(uniqueItems bool) error

func (*Header) Type

func (h *Header) Type() string

func (*Header) UniqueItems

func (h *Header) UniqueItems() bool

type HeaderFields

type HeaderFields struct {
	Description      string
	Type             string
	Format           string
	Items            *Items
	CollectionFormat string
	Default          interface{}
	Maximum          *float64
	ExclusiveMaximum bool
	Minimum          *float64
	ExclusiveMinimum bool
	MaxLength        *uint64
	MinLength        *uint64
	Pattern          string
	MaxItems         *uint64
	MinItems         *uint64
	UniqueItems      bool
	Enum             []interface{}
	MultipleOf       *float64
}

HeaderFields groups all header properties for the constructor.

type Info

type Info struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Info provides metadata about the API. https://swagger.io/specification/v2/#info-object

func NewInfo

func NewInfo(title, description, termsOfService, version string, contact *Contact, license *License) *Info

NewInfo creates a new Info instance.

func (*Info) Contact

func (i *Info) Contact() *Contact

func (*Info) Description

func (i *Info) Description() string

func (*Info) License

func (i *Info) License() *License

func (*Info) MarshalFields

func (i *Info) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Info) MarshalJSON

func (i *Info) MarshalJSON() ([]byte, error)

func (*Info) MarshalYAML

func (i *Info) MarshalYAML() (interface{}, error)

func (*Info) SetContact

func (i *Info) SetContact(contact *Contact) error

func (*Info) SetDescription

func (i *Info) SetDescription(description string) error

func (*Info) SetLicense

func (i *Info) SetLicense(license *License) error

func (*Info) SetTermsOfService

func (i *Info) SetTermsOfService(termsOfService string) error

func (*Info) SetTitle

func (i *Info) SetTitle(title string) error

func (*Info) SetVersion

func (i *Info) SetVersion(version string) error

func (*Info) TermsOfService

func (i *Info) TermsOfService() string

func (*Info) Title

func (i *Info) Title() string

func (*Info) Version

func (i *Info) Version() string

type Items

type Items struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Items describes the type of items in an array parameter. https://swagger.io/specification/v2/#items-object

func NewItems

func NewItems(f ItemsFields) *Items

NewItems creates a new Items instance.

func (*Items) CollectionFormat

func (it *Items) CollectionFormat() string

func (*Items) Default

func (it *Items) Default() interface{}

func (*Items) Enum

func (it *Items) Enum() []interface{}

func (*Items) ExclusiveMaximum

func (it *Items) ExclusiveMaximum() bool

func (*Items) ExclusiveMinimum

func (it *Items) ExclusiveMinimum() bool

func (*Items) Format

func (it *Items) Format() string

func (*Items) Items

func (it *Items) Items() *Items

func (*Items) MarshalFields

func (it *Items) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Items) MarshalJSON

func (it *Items) MarshalJSON() ([]byte, error)

func (*Items) MarshalYAML

func (it *Items) MarshalYAML() (interface{}, error)

func (*Items) MaxItems

func (it *Items) MaxItems() *uint64

func (*Items) MaxLength

func (it *Items) MaxLength() *uint64

func (*Items) Maximum

func (it *Items) Maximum() *float64

func (*Items) MinItems

func (it *Items) MinItems() *uint64

func (*Items) MinLength

func (it *Items) MinLength() *uint64

func (*Items) Minimum

func (it *Items) Minimum() *float64

func (*Items) MultipleOf

func (it *Items) MultipleOf() *float64

func (*Items) Pattern

func (it *Items) Pattern() string

func (*Items) SetCollectionFormat

func (it *Items) SetCollectionFormat(collectionFormat string) error

func (*Items) SetDefault

func (it *Items) SetDefault(defaultVal interface{}) error

func (*Items) SetEnum

func (it *Items) SetEnum(enum []interface{}) error

func (*Items) SetExclusiveMaximum

func (it *Items) SetExclusiveMaximum(exclusiveMaximum bool) error

func (*Items) SetExclusiveMinimum

func (it *Items) SetExclusiveMinimum(exclusiveMinimum bool) error

func (*Items) SetFormat

func (it *Items) SetFormat(format string) error

func (*Items) SetItems

func (it *Items) SetItems(items *Items) error

func (*Items) SetMaxItems

func (it *Items) SetMaxItems(maxItems *uint64) error

func (*Items) SetMaxLength

func (it *Items) SetMaxLength(maxLength *uint64) error

func (*Items) SetMaximum

func (it *Items) SetMaximum(maximum *float64) error

func (*Items) SetMinItems

func (it *Items) SetMinItems(minItems *uint64) error

func (*Items) SetMinLength

func (it *Items) SetMinLength(minLength *uint64) error

func (*Items) SetMinimum

func (it *Items) SetMinimum(minimum *float64) error

func (*Items) SetMultipleOf

func (it *Items) SetMultipleOf(multipleOf *float64) error

func (*Items) SetPattern

func (it *Items) SetPattern(pattern string) error

func (*Items) SetType

func (it *Items) SetType(itemType string) error

func (*Items) SetUniqueItems

func (it *Items) SetUniqueItems(uniqueItems bool) error

func (*Items) Type

func (it *Items) Type() string

func (*Items) UniqueItems

func (it *Items) UniqueItems() bool

type ItemsFields

type ItemsFields struct {
	Type             string
	Format           string
	Items            *Items
	CollectionFormat string
	Default          interface{}
	Maximum          *float64
	ExclusiveMaximum bool
	Minimum          *float64
	ExclusiveMinimum bool
	MaxLength        *uint64
	MinLength        *uint64
	Pattern          string
	MaxItems         *uint64
	MinItems         *uint64
	UniqueItems      bool
	Enum             []interface{}
	MultipleOf       *float64
}

ItemsFields groups all items properties for the constructor.

type License

type License struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

License provides license information for the API. https://swagger.io/specification/v2/#license-object

func NewLicense

func NewLicense(name, url string) *License

NewLicense creates a new License instance.

func (*License) MarshalFields

func (l *License) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*License) MarshalJSON

func (l *License) MarshalJSON() ([]byte, error)

func (*License) MarshalYAML

func (l *License) MarshalYAML() (interface{}, error)

func (*License) Name

func (l *License) Name() string

func (*License) SetName

func (l *License) SetName(name string) error

func (*License) SetURL

func (l *License) SetURL(url string) error

func (*License) URL

func (l *License) URL() string

type Location

type Location = shared.Location

Type aliases for shared meta types.

type NodeSource

type NodeSource = shared.NodeSource

type Operation

type Operation struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Operation describes a single API operation on a path. https://swagger.io/specification/v2/#operation-object

func NewOperation

func NewOperation(
	tags []string, summary, description string, externalDocs *ExternalDocs,
	operationID string, consumes, produces []string,
	parameters []*RefParameter, responses *Responses,
	schemes []string, deprecated bool, security []SecurityRequirement,
) *Operation

NewOperation creates a new Operation instance.

func (*Operation) Consumes

func (o *Operation) Consumes() []string

func (*Operation) Deprecated

func (o *Operation) Deprecated() bool

func (*Operation) Description

func (o *Operation) Description() string

func (*Operation) ExternalDocs

func (o *Operation) ExternalDocs() *ExternalDocs

func (*Operation) MarshalFields

func (o *Operation) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Operation) MarshalJSON

func (o *Operation) MarshalJSON() ([]byte, error)

func (*Operation) MarshalYAML

func (o *Operation) MarshalYAML() (interface{}, error)

func (*Operation) OperationID

func (o *Operation) OperationID() string

func (*Operation) Parameters

func (o *Operation) Parameters() []*RefParameter

func (*Operation) Produces

func (o *Operation) Produces() []string

func (*Operation) Responses

func (o *Operation) Responses() *Responses

func (*Operation) Schemes

func (o *Operation) Schemes() []string

func (*Operation) Security

func (o *Operation) Security() []SecurityRequirement

func (*Operation) SetConsumes

func (o *Operation) SetConsumes(consumes []string) error

func (*Operation) SetDeprecated

func (o *Operation) SetDeprecated(deprecated bool) error

func (*Operation) SetDescription

func (o *Operation) SetDescription(description string) error

func (*Operation) SetExternalDocs

func (o *Operation) SetExternalDocs(externalDocs *ExternalDocs) error

func (*Operation) SetOperationID

func (o *Operation) SetOperationID(operationID string) error

func (*Operation) SetParameters

func (o *Operation) SetParameters(parameters []*RefParameter) error

func (*Operation) SetProduces

func (o *Operation) SetProduces(produces []string) error

func (*Operation) SetResponses

func (o *Operation) SetResponses(responses *Responses) error

func (*Operation) SetSchemes

func (o *Operation) SetSchemes(schemes []string) error

func (*Operation) SetSecurity

func (o *Operation) SetSecurity(security []SecurityRequirement) error

func (*Operation) SetSummary

func (o *Operation) SetSummary(summary string) error

func (*Operation) SetTags

func (o *Operation) SetTags(tags []string) error

func (*Operation) Summary

func (o *Operation) Summary() string

func (*Operation) Tags

func (o *Operation) Tags() []string

type Parameter

type Parameter struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Parameter describes a single operation parameter. https://swagger.io/specification/v2/#parameter-object

func NewParameter

func NewParameter(f ParameterFields) *Parameter

NewParameter creates a new Parameter instance.

func (*Parameter) AllowEmptyValue

func (p *Parameter) AllowEmptyValue() bool

func (*Parameter) CollectionFormat

func (p *Parameter) CollectionFormat() string

func (*Parameter) Default

func (p *Parameter) Default() interface{}

func (*Parameter) Description

func (p *Parameter) Description() string

func (*Parameter) Enum

func (p *Parameter) Enum() []interface{}

func (*Parameter) ExclusiveMaximum

func (p *Parameter) ExclusiveMaximum() bool

func (*Parameter) ExclusiveMinimum

func (p *Parameter) ExclusiveMinimum() bool

func (*Parameter) Format

func (p *Parameter) Format() string

func (*Parameter) In

func (p *Parameter) In() string

func (*Parameter) Items

func (p *Parameter) Items() *Items

func (*Parameter) MarshalFields

func (p *Parameter) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Parameter) MarshalJSON

func (p *Parameter) MarshalJSON() ([]byte, error)

func (*Parameter) MarshalYAML

func (p *Parameter) MarshalYAML() (interface{}, error)

func (*Parameter) MaxItems

func (p *Parameter) MaxItems() *uint64

func (*Parameter) MaxLength

func (p *Parameter) MaxLength() *uint64

func (*Parameter) Maximum

func (p *Parameter) Maximum() *float64

func (*Parameter) MinItems

func (p *Parameter) MinItems() *uint64

func (*Parameter) MinLength

func (p *Parameter) MinLength() *uint64

func (*Parameter) Minimum

func (p *Parameter) Minimum() *float64

func (*Parameter) MultipleOf

func (p *Parameter) MultipleOf() *float64

func (*Parameter) Name

func (p *Parameter) Name() string

func (*Parameter) Pattern

func (p *Parameter) Pattern() string

func (*Parameter) Required

func (p *Parameter) Required() bool

func (*Parameter) Schema

func (p *Parameter) Schema() *RefSchema

func (*Parameter) SetAllowEmptyValue

func (p *Parameter) SetAllowEmptyValue(allowEmptyValue bool) error

func (*Parameter) SetCollectionFormat

func (p *Parameter) SetCollectionFormat(collectionFormat string) error

func (*Parameter) SetDefault

func (p *Parameter) SetDefault(defaultVal interface{}) error

func (*Parameter) SetDescription

func (p *Parameter) SetDescription(description string) error

func (*Parameter) SetEnum

func (p *Parameter) SetEnum(enum []interface{}) error

func (*Parameter) SetExclusiveMaximum

func (p *Parameter) SetExclusiveMaximum(exclusiveMaximum bool) error

func (*Parameter) SetExclusiveMinimum

func (p *Parameter) SetExclusiveMinimum(exclusiveMinimum bool) error

func (*Parameter) SetFormat

func (p *Parameter) SetFormat(format string) error

func (*Parameter) SetIn

func (p *Parameter) SetIn(in string) error

func (*Parameter) SetItems

func (p *Parameter) SetItems(items *Items) error

func (*Parameter) SetMaxItems

func (p *Parameter) SetMaxItems(maxItems *uint64) error

func (*Parameter) SetMaxLength

func (p *Parameter) SetMaxLength(maxLength *uint64) error

func (*Parameter) SetMaximum

func (p *Parameter) SetMaximum(maximum *float64) error

func (*Parameter) SetMinItems

func (p *Parameter) SetMinItems(minItems *uint64) error

func (*Parameter) SetMinLength

func (p *Parameter) SetMinLength(minLength *uint64) error

func (*Parameter) SetMinimum

func (p *Parameter) SetMinimum(minimum *float64) error

func (*Parameter) SetMultipleOf

func (p *Parameter) SetMultipleOf(multipleOf *float64) error

func (*Parameter) SetName

func (p *Parameter) SetName(name string) error

func (*Parameter) SetPattern

func (p *Parameter) SetPattern(pattern string) error

func (*Parameter) SetRequired

func (p *Parameter) SetRequired(required bool) error

func (*Parameter) SetSchema

func (p *Parameter) SetSchema(schema *RefSchema) error

func (*Parameter) SetType

func (p *Parameter) SetType(paramType string) error

func (*Parameter) SetUniqueItems

func (p *Parameter) SetUniqueItems(uniqueItems bool) error

func (*Parameter) Type

func (p *Parameter) Type() string

func (*Parameter) UniqueItems

func (p *Parameter) UniqueItems() bool

type ParameterFields

type ParameterFields struct {
	Name             string
	In               string
	Description      string
	Required         bool
	AllowEmptyValue  bool
	Schema           *RefSchema
	Type             string
	Format           string
	Items            *Items
	CollectionFormat string
	Default          interface{}
	Maximum          *float64
	ExclusiveMaximum bool
	Minimum          *float64
	ExclusiveMinimum bool
	MaxLength        *uint64
	MinLength        *uint64
	Pattern          string
	MaxItems         *uint64
	MinItems         *uint64
	UniqueItems      bool
	Enum             []interface{}
	MultipleOf       *float64
}

ParameterFields groups all parameter properties for the constructor.

type ParseError

type ParseError = shared.ParseError

type PathItem

type PathItem struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

PathItem describes operations available on a single path. https://swagger.io/specification/v2/#path-item-object

func NewPathItem

func NewPathItem(
	ref string,
	get, put, post, del, options, head, patch *Operation,
	parameters []*RefParameter,
) *PathItem

NewPathItem creates a new PathItem instance.

func (*PathItem) Delete

func (pi *PathItem) Delete() *Operation

func (*PathItem) Get

func (pi *PathItem) Get() *Operation

func (*PathItem) Head

func (pi *PathItem) Head() *Operation

func (*PathItem) MarshalFields

func (pi *PathItem) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*PathItem) MarshalJSON

func (pi *PathItem) MarshalJSON() ([]byte, error)

func (*PathItem) MarshalYAML

func (pi *PathItem) MarshalYAML() (interface{}, error)

func (*PathItem) Options

func (pi *PathItem) Options() *Operation

func (*PathItem) Parameters

func (pi *PathItem) Parameters() []*RefParameter

func (*PathItem) Patch

func (pi *PathItem) Patch() *Operation

func (*PathItem) Post

func (pi *PathItem) Post() *Operation

func (*PathItem) Put

func (pi *PathItem) Put() *Operation

func (*PathItem) Ref

func (pi *PathItem) Ref() string

func (*PathItem) SetDelete

func (pi *PathItem) SetDelete(delete *Operation) error

func (*PathItem) SetGet

func (pi *PathItem) SetGet(get *Operation) error

func (*PathItem) SetHead

func (pi *PathItem) SetHead(head *Operation) error

func (*PathItem) SetOptions

func (pi *PathItem) SetOptions(options *Operation) error

func (*PathItem) SetParameters

func (pi *PathItem) SetParameters(parameters []*RefParameter) error

func (*PathItem) SetPatch

func (pi *PathItem) SetPatch(patch *Operation) error

func (*PathItem) SetPost

func (pi *PathItem) SetPost(post *Operation) error

func (*PathItem) SetPut

func (pi *PathItem) SetPut(put *Operation) error

func (*PathItem) SetRef

func (pi *PathItem) SetRef(ref string) error

type Paths

type Paths struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Paths holds the relative paths to individual endpoints. https://swagger.io/specification/v2/#paths-object

func NewPaths

func NewPaths(items map[string]*PathItem) *Paths

NewPaths creates a new Paths instance with the given items map.

func (*Paths) Items

func (p *Paths) Items() map[string]*PathItem

func (*Paths) MarshalFields

func (p *Paths) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Paths) MarshalJSON

func (p *Paths) MarshalJSON() ([]byte, error)

func (*Paths) MarshalYAML

func (p *Paths) MarshalYAML() (interface{}, error)

func (*Paths) SetItems

func (p *Paths) SetItems(items map[string]*PathItem) error

type RefParameter

type RefParameter = shared.Ref[Parameter]

func NewRefParameter

func NewRefParameter(ref string) *RefParameter

NewRefParameter creates a Ref to a Parameter.

type RefResponse

type RefResponse = shared.Ref[Response]

func NewRefResponse

func NewRefResponse(ref string) *RefResponse

NewRefResponse creates a Ref to a Response.

type RefSchema

type RefSchema = shared.Ref[Schema]

Ref type aliases — use these instead of shared.Ref[T] throughout the package.

func NewRefSchema

func NewRefSchema(ref string) *RefSchema

NewRefSchema creates a Ref to a Schema.

type Response

type Response struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Response describes a single response from an API operation. https://swagger.io/specification/v2/#response-object

func NewResponse

func NewResponse(description string, schema *RefSchema, headers map[string]*Header, examples map[string]interface{}) *Response

NewResponse creates a new Response instance.

func (*Response) Description

func (r *Response) Description() string

func (*Response) Examples

func (r *Response) Examples() map[string]interface{}

func (*Response) Headers

func (r *Response) Headers() map[string]*Header

func (*Response) MarshalFields

func (r *Response) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Response) MarshalJSON

func (r *Response) MarshalJSON() ([]byte, error)

func (*Response) MarshalYAML

func (r *Response) MarshalYAML() (interface{}, error)

func (*Response) Schema

func (r *Response) Schema() *RefSchema

func (*Response) SetDescription

func (r *Response) SetDescription(description string) error

func (*Response) SetExamples

func (r *Response) SetExamples(examples map[string]interface{}) error

func (*Response) SetHeaders

func (r *Response) SetHeaders(headers map[string]*Header) error

func (*Response) SetSchema

func (r *Response) SetSchema(schema *RefSchema) error

type Responses

type Responses struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Responses is a container for expected responses of an operation. https://swagger.io/specification/v2/#responses-object

func NewResponses

func NewResponses(defaultResp *RefResponse, codes map[string]*RefResponse) *Responses

NewResponses creates a new Responses instance.

func (*Responses) Codes

func (r *Responses) Codes() map[string]*RefResponse

func (*Responses) Default

func (r *Responses) Default() *RefResponse

func (*Responses) MarshalFields

func (r *Responses) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Responses) MarshalJSON

func (r *Responses) MarshalJSON() ([]byte, error)

func (*Responses) MarshalYAML

func (r *Responses) MarshalYAML() (interface{}, error)

func (*Responses) SetCodes

func (r *Responses) SetCodes(codes map[string]*RefResponse) error

func (*Responses) SetDefault

func (r *Responses) SetDefault(defaultResp *RefResponse) error

type Schema

type Schema struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Schema represents the Swagger 2.0 Schema Object (JSON Schema subset). https://swagger.io/specification/v2/#schema-object

func NewSchema

func NewSchema(f SchemaFields) *Schema

NewSchema creates a new Schema instance.

func (*Schema) AdditionalProperties

func (s *Schema) AdditionalProperties() *RefSchema

func (*Schema) AdditionalPropertiesAllowed

func (s *Schema) AdditionalPropertiesAllowed() *bool

func (*Schema) AllOf

func (s *Schema) AllOf() []*RefSchema

func (*Schema) Default

func (s *Schema) Default() interface{}

func (*Schema) Description

func (s *Schema) Description() string

func (*Schema) Discriminator

func (s *Schema) Discriminator() string

func (*Schema) Enum

func (s *Schema) Enum() []interface{}

func (*Schema) Example

func (s *Schema) Example() interface{}

func (*Schema) ExclusiveMaximum

func (s *Schema) ExclusiveMaximum() bool

func (*Schema) ExclusiveMinimum

func (s *Schema) ExclusiveMinimum() bool

func (*Schema) ExternalDocs

func (s *Schema) ExternalDocs() *ExternalDocs

func (*Schema) Format

func (s *Schema) Format() string

func (*Schema) Items

func (s *Schema) Items() *RefSchema

func (*Schema) MarshalFields

func (s *Schema) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Schema) MarshalJSON

func (s *Schema) MarshalJSON() ([]byte, error)

func (*Schema) MarshalYAML

func (s *Schema) MarshalYAML() (interface{}, error)

func (*Schema) MaxItems

func (s *Schema) MaxItems() *uint64

func (*Schema) MaxLength

func (s *Schema) MaxLength() *uint64

func (*Schema) MaxProperties

func (s *Schema) MaxProperties() *uint64

func (*Schema) Maximum

func (s *Schema) Maximum() *float64

func (*Schema) MinItems

func (s *Schema) MinItems() *uint64

func (*Schema) MinLength

func (s *Schema) MinLength() *uint64

func (*Schema) MinProperties

func (s *Schema) MinProperties() *uint64

func (*Schema) Minimum

func (s *Schema) Minimum() *float64

func (*Schema) MultipleOf

func (s *Schema) MultipleOf() *float64

func (*Schema) Pattern

func (s *Schema) Pattern() string

func (*Schema) Properties

func (s *Schema) Properties() map[string]*RefSchema

func (*Schema) ReadOnly

func (s *Schema) ReadOnly() bool

func (*Schema) Required

func (s *Schema) Required() []string

func (*Schema) SetAdditionalProperties

func (s *Schema) SetAdditionalProperties(additionalProperties *RefSchema) error

func (*Schema) SetAdditionalPropertiesAllowed

func (s *Schema) SetAdditionalPropertiesAllowed(additionalPropertiesAllowed *bool) error

func (*Schema) SetAllOf

func (s *Schema) SetAllOf(allOf []*RefSchema) error

func (*Schema) SetDefault

func (s *Schema) SetDefault(defaultVal interface{}) error

func (*Schema) SetDescription

func (s *Schema) SetDescription(description string) error

func (*Schema) SetDiscriminator

func (s *Schema) SetDiscriminator(discriminator string) error

func (*Schema) SetEnum

func (s *Schema) SetEnum(enum []interface{}) error

func (*Schema) SetExample

func (s *Schema) SetExample(example interface{}) error

func (*Schema) SetExclusiveMaximum

func (s *Schema) SetExclusiveMaximum(exclusiveMaximum bool) error

func (*Schema) SetExclusiveMinimum

func (s *Schema) SetExclusiveMinimum(exclusiveMinimum bool) error

func (*Schema) SetExternalDocs

func (s *Schema) SetExternalDocs(externalDocs *ExternalDocs) error

func (*Schema) SetFormat

func (s *Schema) SetFormat(format string) error

func (*Schema) SetItems

func (s *Schema) SetItems(items *RefSchema) error

func (*Schema) SetMaxItems

func (s *Schema) SetMaxItems(maxItems *uint64) error

func (*Schema) SetMaxLength

func (s *Schema) SetMaxLength(maxLength *uint64) error

func (*Schema) SetMaxProperties

func (s *Schema) SetMaxProperties(maxProperties *uint64) error

func (*Schema) SetMaximum

func (s *Schema) SetMaximum(maximum *float64) error

func (*Schema) SetMinItems

func (s *Schema) SetMinItems(minItems *uint64) error

func (*Schema) SetMinLength

func (s *Schema) SetMinLength(minLength *uint64) error

func (*Schema) SetMinProperties

func (s *Schema) SetMinProperties(minProperties *uint64) error

func (*Schema) SetMinimum

func (s *Schema) SetMinimum(minimum *float64) error

func (*Schema) SetMultipleOf

func (s *Schema) SetMultipleOf(multipleOf *float64) error

func (*Schema) SetPattern

func (s *Schema) SetPattern(pattern string) error

func (*Schema) SetProperties

func (s *Schema) SetProperties(properties map[string]*RefSchema) error

func (*Schema) SetReadOnly

func (s *Schema) SetReadOnly(readOnly bool) error

func (*Schema) SetRequired

func (s *Schema) SetRequired(required []string) error

func (*Schema) SetTitle

func (s *Schema) SetTitle(title string) error

func (*Schema) SetType

func (s *Schema) SetType(schemaType string) error

func (*Schema) SetUniqueItems

func (s *Schema) SetUniqueItems(uniqueItems bool) error

func (*Schema) SetXML

func (s *Schema) SetXML(xml *XML) error

func (*Schema) Title

func (s *Schema) Title() string

func (*Schema) Type

func (s *Schema) Type() string

func (*Schema) UniqueItems

func (s *Schema) UniqueItems() bool

func (*Schema) XML

func (s *Schema) XML() *XML

type SchemaFields

type SchemaFields struct {
	Title                       string
	Description                 string
	Default                     interface{}
	MultipleOf                  *float64
	Maximum                     *float64
	ExclusiveMaximum            bool
	Minimum                     *float64
	ExclusiveMinimum            bool
	MaxLength                   *uint64
	MinLength                   *uint64
	Pattern                     string
	MaxItems                    *uint64
	MinItems                    *uint64
	UniqueItems                 bool
	MaxProperties               *uint64
	MinProperties               *uint64
	Required                    []string
	Enum                        []interface{}
	Type                        string
	Format                      string
	AllOf                       []*RefSchema
	Items                       *RefSchema
	Properties                  map[string]*RefSchema
	AdditionalProperties        *RefSchema
	AdditionalPropertiesAllowed *bool
	Discriminator               string
	ReadOnly                    bool
	XML                         *XML
	ExternalDocs                *ExternalDocs
	Example                     interface{}
}

SchemaFields groups all schema properties for the constructor.

type SecurityRequirement

type SecurityRequirement map[string][]string

SecurityRequirement lists required security schemes to execute an operation. https://swagger.io/specification/v2/#security-requirement-object

type SecurityScheme

type SecurityScheme struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

SecurityScheme defines a security scheme for the API. https://swagger.io/specification/v2/#security-scheme-object

func NewSecurityScheme

func NewSecurityScheme(
	securityType, description, name, in, flow, authorizationURL, tokenURL string,
	scopes map[string]string,
) *SecurityScheme

NewSecurityScheme creates a new SecurityScheme instance.

func (*SecurityScheme) AuthorizationURL

func (s *SecurityScheme) AuthorizationURL() string

func (*SecurityScheme) Description

func (s *SecurityScheme) Description() string

func (*SecurityScheme) Flow

func (s *SecurityScheme) Flow() string

func (*SecurityScheme) In

func (s *SecurityScheme) In() string

func (*SecurityScheme) MarshalFields

func (s *SecurityScheme) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*SecurityScheme) MarshalJSON

func (s *SecurityScheme) MarshalJSON() ([]byte, error)

func (*SecurityScheme) MarshalYAML

func (s *SecurityScheme) MarshalYAML() (interface{}, error)

func (*SecurityScheme) Name

func (s *SecurityScheme) Name() string

func (*SecurityScheme) Scopes

func (s *SecurityScheme) Scopes() map[string]string

func (*SecurityScheme) SetAuthorizationURL

func (s *SecurityScheme) SetAuthorizationURL(authorizationURL string) error

func (*SecurityScheme) SetDescription

func (s *SecurityScheme) SetDescription(description string) error

func (*SecurityScheme) SetFlow

func (s *SecurityScheme) SetFlow(flow string) error

func (*SecurityScheme) SetIn

func (s *SecurityScheme) SetIn(in string) error

func (*SecurityScheme) SetName

func (s *SecurityScheme) SetName(name string) error

func (*SecurityScheme) SetScopes

func (s *SecurityScheme) SetScopes(scopes map[string]string) error

func (*SecurityScheme) SetTokenURL

func (s *SecurityScheme) SetTokenURL(tokenURL string) error

func (*SecurityScheme) SetType

func (s *SecurityScheme) SetType(securityType string) error

func (*SecurityScheme) TokenURL

func (s *SecurityScheme) TokenURL() string

func (*SecurityScheme) Type

func (s *SecurityScheme) Type() string

type Swagger

type Swagger struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Swagger is the root document object of the Swagger 2.0 specification. https://swagger.io/specification/v2/#swagger-object

func (*Swagger) BasePath

func (s *Swagger) BasePath() string

func (*Swagger) Consumes

func (s *Swagger) Consumes() []string

func (*Swagger) Definitions

func (s *Swagger) Definitions() map[string]*RefSchema

func (*Swagger) ExternalDocs

func (s *Swagger) ExternalDocs() *ExternalDocs

func (*Swagger) Host

func (s *Swagger) Host() string

func (*Swagger) Info

func (s *Swagger) Info() *Info

func (*Swagger) MarshalFields

func (s *Swagger) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Swagger) MarshalJSON

func (s *Swagger) MarshalJSON() ([]byte, error)

func (*Swagger) MarshalYAML

func (s *Swagger) MarshalYAML() (interface{}, error)

func (*Swagger) Parameters

func (s *Swagger) Parameters() map[string]*RefParameter

func (*Swagger) Paths

func (s *Swagger) Paths() *Paths

func (*Swagger) Produces

func (s *Swagger) Produces() []string

func (*Swagger) Responses

func (s *Swagger) Responses() map[string]*RefResponse

func (*Swagger) Schemes

func (s *Swagger) Schemes() []string

func (*Swagger) Security

func (s *Swagger) Security() []SecurityRequirement

func (*Swagger) SecurityDefinitions

func (s *Swagger) SecurityDefinitions() map[string]*SecurityScheme

func (*Swagger) SetBasePath

func (s *Swagger) SetBasePath(basePath string) error

func (*Swagger) SetConsumes

func (s *Swagger) SetConsumes(consumes []string) error

func (*Swagger) SetDefinitions

func (s *Swagger) SetDefinitions(definitions map[string]*RefSchema) error

func (*Swagger) SetExternalDocs

func (s *Swagger) SetExternalDocs(externalDocs *ExternalDocs) error

func (*Swagger) SetHost

func (s *Swagger) SetHost(host string) error

func (*Swagger) SetInfo

func (s *Swagger) SetInfo(info *Info) error

func (*Swagger) SetParameters

func (s *Swagger) SetParameters(parameters map[string]*RefParameter) error

func (*Swagger) SetPaths

func (s *Swagger) SetPaths(paths *Paths) error

func (*Swagger) SetProduces

func (s *Swagger) SetProduces(produces []string) error

func (*Swagger) SetProperty

func (s *Swagger) SetProperty(key string, value interface{})

SetProperty sets a property on the Swagger document. Used by parsers for incremental building of the root document where many fields are optional.

func (*Swagger) SetResponses

func (s *Swagger) SetResponses(responses map[string]*RefResponse) error

func (*Swagger) SetSchemes

func (s *Swagger) SetSchemes(schemes []string) error

func (*Swagger) SetSecurity

func (s *Swagger) SetSecurity(security []SecurityRequirement) error

func (*Swagger) SetSecurityDefinitions

func (s *Swagger) SetSecurityDefinitions(securityDefinitions map[string]*SecurityScheme) error

func (*Swagger) SetSwaggerVersion

func (s *Swagger) SetSwaggerVersion(swagger string) error

func (*Swagger) SetTags

func (s *Swagger) SetTags(tags []*Tag) error

func (*Swagger) SwaggerVersion

func (s *Swagger) SwaggerVersion() string

func (*Swagger) Tags

func (s *Swagger) Tags() []*Tag

type Tag

type Tag struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Tag adds metadata to a single tag used by the Operation Object. https://swagger.io/specification/v2/#tag-object

func NewTag

func NewTag(name, description string, externalDocs *ExternalDocs) *Tag

NewTag creates a new Tag instance.

func (*Tag) Description

func (t *Tag) Description() string

func (*Tag) ExternalDocs

func (t *Tag) ExternalDocs() *ExternalDocs

func (*Tag) MarshalFields

func (t *Tag) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Tag) MarshalJSON

func (t *Tag) MarshalJSON() ([]byte, error)

func (*Tag) MarshalYAML

func (t *Tag) MarshalYAML() (interface{}, error)

func (*Tag) Name

func (t *Tag) Name() string

func (*Tag) SetDescription

func (t *Tag) SetDescription(description string) error

func (*Tag) SetExternalDocs

func (t *Tag) SetExternalDocs(externalDocs *ExternalDocs) error

func (*Tag) SetName

func (t *Tag) SetName(name string) error

type Trix

type Trix = shared.Trix

type XML

type XML struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

XML provides additional metadata for XML serialization. https://swagger.io/specification/v2/#xml-object

func NewXML

func NewXML(name, namespace, prefix string, attribute, wrapped bool) *XML

NewXML creates a new XML instance.

func (*XML) Attribute

func (x *XML) Attribute() bool

func (*XML) MarshalFields

func (x *XML) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*XML) MarshalJSON

func (x *XML) MarshalJSON() ([]byte, error)

func (*XML) MarshalYAML

func (x *XML) MarshalYAML() (interface{}, error)

func (*XML) Name

func (x *XML) Name() string

func (*XML) Namespace

func (x *XML) Namespace() string

func (*XML) Prefix

func (x *XML) Prefix() string

func (*XML) SetAttribute

func (x *XML) SetAttribute(attribute bool) error

func (*XML) SetName

func (x *XML) SetName(name string) error

func (*XML) SetNamespace

func (x *XML) SetNamespace(namespace string) error

func (*XML) SetPrefix

func (x *XML) SetPrefix(prefix string) error

func (*XML) SetWrapped

func (x *XML) SetWrapped(wrapped bool) error

func (*XML) Wrapped

func (x *XML) Wrapped() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL