openapi31

package
v0.2.44 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package openapi31 provides entities and helpers to manage OpenAPI 3.1.x schema.

PLEASE NOTE: this package is currently experimental and may have backwards incompatible API changes in near future. API would be considered stable, once this disclaimer is removed. Give it a try and file issues if you face any.

Package openapi31 contains JSON mapping structures.

Index

Examples

Constants

View Source
const (
	ParameterInQuery  = ParameterIn("query")
	ParameterInHeader = ParameterIn("header")
	ParameterInPath   = ParameterIn("path")
	ParameterInCookie = ParameterIn("cookie")
)

ParameterIn values enumeration.

View Source
const (
	EncodingStyleForm           = EncodingStyle("form")
	EncodingStyleSpaceDelimited = EncodingStyle("spaceDelimited")
	EncodingStylePipeDelimited  = EncodingStyle("pipeDelimited")
	EncodingStyleDeepObject     = EncodingStyle("deepObject")
)

EncodingStyle values enumeration.

View Source
const (
	ParameterStyleForm           = ParameterStyle("form")
	ParameterStyleSpaceDelimited = ParameterStyle("spaceDelimited")
	ParameterStylePipeDelimited  = ParameterStyle("pipeDelimited")
	ParameterStyleDeepObject     = ParameterStyle("deepObject")
)

ParameterStyle values enumeration.

View Source
const (
	SecuritySchemeAPIKeyInQuery  = SecuritySchemeAPIKeyIn("query")
	SecuritySchemeAPIKeyInHeader = SecuritySchemeAPIKeyIn("header")
	SecuritySchemeAPIKeyInCookie = SecuritySchemeAPIKeyIn("cookie")
)

SecuritySchemeAPIKeyIn values enumeration.

Variables

This section is empty.

Functions

func ToJSONSchema

func ToJSONSchema(s map[string]interface{}, spec *Spec) jsonschema.SchemaOrBool

ToJSONSchema converts OpenAPI Schema to JSON Schema.

Local references are resolved against `#/components/schemas` in spec.

Types

type Callbacks

type Callbacks struct {
	MapOfAnything        map[string]interface{}         `json:"-"` // Key must match pattern: `^x-`.
	AdditionalProperties map[string]PathItemOrReference `json:"-"` // All unmatched properties.
}

Callbacks structure is generated from "#/$defs/callbacks".

func (Callbacks) MarshalJSON

func (c Callbacks) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Callbacks) UnmarshalJSON

func (c *Callbacks) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Callbacks) WithAdditionalProperties

func (c *Callbacks) WithAdditionalProperties(val map[string]PathItemOrReference) *Callbacks

WithAdditionalProperties sets AdditionalProperties value.

func (*Callbacks) WithAdditionalPropertiesItem

func (c *Callbacks) WithAdditionalPropertiesItem(key string, val PathItemOrReference) *Callbacks

WithAdditionalPropertiesItem sets AdditionalProperties item value.

func (*Callbacks) WithMapOfAnything

func (c *Callbacks) WithMapOfAnything(val map[string]interface{}) *Callbacks

WithMapOfAnything sets MapOfAnything value.

func (*Callbacks) WithMapOfAnythingItem

func (c *Callbacks) WithMapOfAnythingItem(key string, val interface{}) *Callbacks

WithMapOfAnythingItem sets MapOfAnything item value.

type CallbacksOrReference

type CallbacksOrReference struct {
	Reference *Reference `json:"-"`
	Callbacks *Callbacks `json:"-"`
}

CallbacksOrReference structure is generated from "#/$defs/callbacks-or-reference".

func (*CallbacksOrReference) CallbacksEns

func (c *CallbacksOrReference) CallbacksEns() *Callbacks

CallbacksEns ensures returned Callbacks is not nil.

func (CallbacksOrReference) MarshalJSON

func (c CallbacksOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*CallbacksOrReference) ReferenceEns

func (c *CallbacksOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*CallbacksOrReference) UnmarshalJSON

func (c *CallbacksOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*CallbacksOrReference) WithCallbacks

func (c *CallbacksOrReference) WithCallbacks(val Callbacks) *CallbacksOrReference

WithCallbacks sets Callbacks value.

func (*CallbacksOrReference) WithReference

func (c *CallbacksOrReference) WithReference(val Reference) *CallbacksOrReference

WithReference sets Reference value.

type Components

type Components struct {
	Schemas         map[string]map[string]interface{}    `json:"schemas,omitempty"`
	Responses       map[string]ResponseOrReference       `json:"responses,omitempty"`
	Parameters      map[string]ParameterOrReference      `json:"parameters,omitempty"`
	Examples        map[string]ExampleOrReference        `json:"examples,omitempty"`
	RequestBodies   map[string]RequestBodyOrReference    `json:"requestBodies,omitempty"`
	Headers         map[string]HeaderOrReference         `json:"headers,omitempty"`
	SecuritySchemes map[string]SecuritySchemeOrReference `json:"securitySchemes,omitempty"`
	Links           map[string]LinkOrReference           `json:"links,omitempty"`
	Callbacks       map[string]CallbacksOrReference      `json:"callbacks,omitempty"`
	PathItems       map[string]PathItemOrReference       `json:"pathItems,omitempty"`
}

Components structure is generated from "#/$defs/components".

func (*Components) WithCallbacks

func (c *Components) WithCallbacks(val map[string]CallbacksOrReference) *Components

WithCallbacks sets Callbacks value.

func (*Components) WithCallbacksItem

func (c *Components) WithCallbacksItem(key string, val CallbacksOrReference) *Components

WithCallbacksItem sets Callbacks item value.

func (*Components) WithExamples

func (c *Components) WithExamples(val map[string]ExampleOrReference) *Components

WithExamples sets Examples value.

func (*Components) WithExamplesItem

func (c *Components) WithExamplesItem(key string, val ExampleOrReference) *Components

WithExamplesItem sets Examples item value.

func (*Components) WithHeaders

func (c *Components) WithHeaders(val map[string]HeaderOrReference) *Components

WithHeaders sets Headers value.

func (*Components) WithHeadersItem

func (c *Components) WithHeadersItem(key string, val HeaderOrReference) *Components

WithHeadersItem sets Headers item value.

func (c *Components) WithLinks(val map[string]LinkOrReference) *Components

WithLinks sets Links value.

func (*Components) WithLinksItem

func (c *Components) WithLinksItem(key string, val LinkOrReference) *Components

WithLinksItem sets Links item value.

func (*Components) WithParameters

func (c *Components) WithParameters(val map[string]ParameterOrReference) *Components

WithParameters sets Parameters value.

func (*Components) WithParametersItem

func (c *Components) WithParametersItem(key string, val ParameterOrReference) *Components

WithParametersItem sets Parameters item value.

func (*Components) WithPathItems

func (c *Components) WithPathItems(val map[string]PathItemOrReference) *Components

WithPathItems sets PathItems value.

func (*Components) WithPathItemsItem

func (c *Components) WithPathItemsItem(key string, val PathItemOrReference) *Components

WithPathItemsItem sets PathItems item value.

func (*Components) WithRequestBodies

func (c *Components) WithRequestBodies(val map[string]RequestBodyOrReference) *Components

WithRequestBodies sets RequestBodies value.

func (*Components) WithRequestBodiesItem

func (c *Components) WithRequestBodiesItem(key string, val RequestBodyOrReference) *Components

WithRequestBodiesItem sets RequestBodies item value.

func (*Components) WithResponses

func (c *Components) WithResponses(val map[string]ResponseOrReference) *Components

WithResponses sets Responses value.

func (*Components) WithResponsesItem

func (c *Components) WithResponsesItem(key string, val ResponseOrReference) *Components

WithResponsesItem sets Responses item value.

func (*Components) WithSchemas

func (c *Components) WithSchemas(val map[string]map[string]interface{}) *Components

WithSchemas sets Schemas value.

func (*Components) WithSchemasItem

func (c *Components) WithSchemasItem(key string, val map[string]interface{}) *Components

WithSchemasItem sets Schemas item value.

func (*Components) WithSecuritySchemes

func (c *Components) WithSecuritySchemes(val map[string]SecuritySchemeOrReference) *Components

WithSecuritySchemes sets SecuritySchemes value.

func (*Components) WithSecuritySchemesItem

func (c *Components) WithSecuritySchemesItem(key string, val SecuritySchemeOrReference) *Components

WithSecuritySchemesItem sets SecuritySchemes item value.

type Contact

type Contact struct {
	Name          *string                `json:"name,omitempty"`
	URL           *string                `json:"url,omitempty"`   // Format: uri.
	Email         *string                `json:"email,omitempty"` // Format: email.
	MapOfAnything map[string]interface{} `json:"-"`               // Key must match pattern: `^x-`.
}

Contact structure is generated from "#/$defs/contact".

func (Contact) MarshalJSON

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

MarshalJSON encodes JSON.

func (*Contact) UnmarshalJSON

func (c *Contact) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Contact) WithEmail

func (c *Contact) WithEmail(val string) *Contact

WithEmail sets Email value.

func (*Contact) WithMapOfAnything

func (c *Contact) WithMapOfAnything(val map[string]interface{}) *Contact

WithMapOfAnything sets MapOfAnything value.

func (*Contact) WithMapOfAnythingItem

func (c *Contact) WithMapOfAnythingItem(key string, val interface{}) *Contact

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Contact) WithName

func (c *Contact) WithName(val string) *Contact

WithName sets Name value.

func (*Contact) WithURL

func (c *Contact) WithURL(val string) *Contact

WithURL sets URL value.

type Encoding

type Encoding struct {
	ContentType   *string                      `json:"contentType,omitempty"` // Format: media-range.
	Headers       map[string]HeaderOrReference `json:"headers,omitempty"`
	Style         *EncodingStyle               `json:"style,omitempty"`
	Explode       *bool                        `json:"explode,omitempty"`
	AllowReserved *bool                        `json:"allowReserved,omitempty"`
}

Encoding structure is generated from "#/$defs/encoding".

func (*Encoding) WithAllowReserved

func (e *Encoding) WithAllowReserved(val bool) *Encoding

WithAllowReserved sets AllowReserved value.

func (*Encoding) WithContentType

func (e *Encoding) WithContentType(val string) *Encoding

WithContentType sets ContentType value.

func (*Encoding) WithExplode

func (e *Encoding) WithExplode(val bool) *Encoding

WithExplode sets Explode value.

func (*Encoding) WithHeaders

func (e *Encoding) WithHeaders(val map[string]HeaderOrReference) *Encoding

WithHeaders sets Headers value.

func (*Encoding) WithHeadersItem

func (e *Encoding) WithHeadersItem(key string, val HeaderOrReference) *Encoding

WithHeadersItem sets Headers item value.

func (*Encoding) WithStyle

func (e *Encoding) WithStyle(val EncodingStyle) *Encoding

WithStyle sets Style value.

type EncodingAllOf0

type EncodingAllOf0 struct {
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

EncodingAllOf0 structure is generated from "#/$defs/encoding/allOf/0".

func (EncodingAllOf0) MarshalJSON

func (e EncodingAllOf0) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*EncodingAllOf0) UnmarshalJSON

func (e *EncodingAllOf0) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*EncodingAllOf0) WithMapOfAnything

func (e *EncodingAllOf0) WithMapOfAnything(val map[string]interface{}) *EncodingAllOf0

WithMapOfAnything sets MapOfAnything value.

func (*EncodingAllOf0) WithMapOfAnythingItem

func (e *EncodingAllOf0) WithMapOfAnythingItem(key string, val interface{}) *EncodingAllOf0

WithMapOfAnythingItem sets MapOfAnything item value.

type EncodingStyle

type EncodingStyle string

EncodingStyle is an enum type.

func (EncodingStyle) MarshalJSON

func (i EncodingStyle) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*EncodingStyle) UnmarshalJSON

func (i *EncodingStyle) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type Example

type Example struct {
	Summary       *string                `json:"summary,omitempty"`
	Description   *string                `json:"description,omitempty"`
	Value         *interface{}           `json:"value,omitempty"`
	ExternalValue *string                `json:"externalValue,omitempty"` // Format: uri.
	MapOfAnything map[string]interface{} `json:"-"`                       // Key must match pattern: `^x-`.
}

Example structure is generated from "#/$defs/example".

func (Example) MarshalJSON

func (e Example) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Example) UnmarshalJSON

func (e *Example) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Example) WithDescription

func (e *Example) WithDescription(val string) *Example

WithDescription sets Description value.

func (*Example) WithExternalValue

func (e *Example) WithExternalValue(val string) *Example

WithExternalValue sets ExternalValue value.

func (*Example) WithMapOfAnything

func (e *Example) WithMapOfAnything(val map[string]interface{}) *Example

WithMapOfAnything sets MapOfAnything value.

func (*Example) WithMapOfAnythingItem

func (e *Example) WithMapOfAnythingItem(key string, val interface{}) *Example

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Example) WithSummary

func (e *Example) WithSummary(val string) *Example

WithSummary sets Summary value.

func (*Example) WithValue

func (e *Example) WithValue(val interface{}) *Example

WithValue sets Value value.

type ExampleOrReference

type ExampleOrReference struct {
	Reference *Reference `json:"-"`
	Example   *Example   `json:"-"`
}

ExampleOrReference structure is generated from "#/$defs/example-or-reference".

func (*ExampleOrReference) ExampleEns

func (e *ExampleOrReference) ExampleEns() *Example

ExampleEns ensures returned Example is not nil.

func (ExampleOrReference) MarshalJSON

func (e ExampleOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ExampleOrReference) ReferenceEns

func (e *ExampleOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*ExampleOrReference) UnmarshalJSON

func (e *ExampleOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ExampleOrReference) WithExample

func (e *ExampleOrReference) WithExample(val Example) *ExampleOrReference

WithExample sets Example value.

func (*ExampleOrReference) WithReference

func (e *ExampleOrReference) WithReference(val Reference) *ExampleOrReference

WithReference sets Reference value.

type Examples

type Examples struct {
	Example  *interface{}                  `json:"example,omitempty"`
	Examples map[string]ExampleOrReference `json:"examples,omitempty"`
}

Examples structure is generated from "#/$defs/examples".

func (*Examples) WithExample

func (e *Examples) WithExample(val interface{}) *Examples

WithExample sets Example value.

func (*Examples) WithExamples

func (e *Examples) WithExamples(val map[string]ExampleOrReference) *Examples

WithExamples sets Examples value.

func (*Examples) WithExamplesItem

func (e *Examples) WithExamplesItem(key string, val ExampleOrReference) *Examples

WithExamplesItem sets Examples item value.

type ExternalDocumentation

type ExternalDocumentation struct {
	Description *string `json:"description,omitempty"`
	// Format: uri.
	// Required.
	URL           string                 `json:"url"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

ExternalDocumentation structure is generated from "#/$defs/external-documentation".

func (ExternalDocumentation) MarshalJSON

func (e ExternalDocumentation) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ExternalDocumentation) UnmarshalJSON

func (e *ExternalDocumentation) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ExternalDocumentation) WithDescription

func (e *ExternalDocumentation) WithDescription(val string) *ExternalDocumentation

WithDescription sets Description value.

func (*ExternalDocumentation) WithMapOfAnything

func (e *ExternalDocumentation) WithMapOfAnything(val map[string]interface{}) *ExternalDocumentation

WithMapOfAnything sets MapOfAnything value.

func (*ExternalDocumentation) WithMapOfAnythingItem

func (e *ExternalDocumentation) WithMapOfAnythingItem(key string, val interface{}) *ExternalDocumentation

WithMapOfAnythingItem sets MapOfAnything item value.

func (*ExternalDocumentation) WithURL

WithURL sets URL value.

type Header struct {
	Description   *string                       `json:"description,omitempty"`
	Required      *bool                         `json:"required,omitempty"`
	Deprecated    *bool                         `json:"deprecated,omitempty"`
	Schema        map[string]interface{}        `json:"schema,omitempty"`
	Content       map[string]MediaType          `json:"content,omitempty"`
	Example       *interface{}                  `json:"example,omitempty"`
	Examples      map[string]ExampleOrReference `json:"examples,omitempty"`
	Explode       *bool                         `json:"explode,omitempty"`
	MapOfAnything map[string]interface{}        `json:"-"` // Key must match pattern: `^x-`.
}

Header structure is generated from "#/$defs/header".

func (Header) MarshalJSON

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

MarshalJSON encodes JSON.

func (*Header) UnmarshalJSON

func (h *Header) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Header) WithContent

func (h *Header) WithContent(val map[string]MediaType) *Header

WithContent sets Content value.

func (*Header) WithContentItem

func (h *Header) WithContentItem(key string, val MediaType) *Header

WithContentItem sets Content item value.

func (*Header) WithDeprecated

func (h *Header) WithDeprecated(val bool) *Header

WithDeprecated sets Deprecated value.

func (*Header) WithDescription

func (h *Header) WithDescription(val string) *Header

WithDescription sets Description value.

func (*Header) WithExample

func (h *Header) WithExample(val interface{}) *Header

WithExample sets Example value.

func (*Header) WithExamples

func (h *Header) WithExamples(val map[string]ExampleOrReference) *Header

WithExamples sets Examples value.

func (*Header) WithExamplesItem

func (h *Header) WithExamplesItem(key string, val ExampleOrReference) *Header

WithExamplesItem sets Examples item value.

func (*Header) WithExplode

func (h *Header) WithExplode(val bool) *Header

WithExplode sets Explode value.

func (*Header) WithMapOfAnything

func (h *Header) WithMapOfAnything(val map[string]interface{}) *Header

WithMapOfAnything sets MapOfAnything value.

func (*Header) WithMapOfAnythingItem

func (h *Header) WithMapOfAnythingItem(key string, val interface{}) *Header

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Header) WithRequired

func (h *Header) WithRequired(val bool) *Header

WithRequired sets Required value.

func (*Header) WithSchema

func (h *Header) WithSchema(val map[string]interface{}) *Header

WithSchema sets Schema value.

func (*Header) WithSchemaItem

func (h *Header) WithSchemaItem(key string, val interface{}) *Header

WithSchemaItem sets Schema item value.

type HeaderOrReference

type HeaderOrReference struct {
	Reference *Reference `json:"-"`
	Header    *Header    `json:"-"`
}

HeaderOrReference structure is generated from "#/$defs/header-or-reference".

func (*HeaderOrReference) HeaderEns

func (h *HeaderOrReference) HeaderEns() *Header

HeaderEns ensures returned Header is not nil.

func (HeaderOrReference) MarshalJSON

func (h HeaderOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*HeaderOrReference) ReferenceEns

func (h *HeaderOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*HeaderOrReference) UnmarshalJSON

func (h *HeaderOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*HeaderOrReference) WithHeader

func (h *HeaderOrReference) WithHeader(val Header) *HeaderOrReference

WithHeader sets Header value.

func (*HeaderOrReference) WithReference

func (h *HeaderOrReference) WithReference(val Reference) *HeaderOrReference

WithReference sets Reference value.

type Info

type Info struct {
	Title          string                 `json:"title"` // Required.
	Summary        *string                `json:"summary,omitempty"`
	Description    *string                `json:"description,omitempty"`
	TermsOfService *string                `json:"termsOfService,omitempty"` // Format: uri.
	Contact        *Contact               `json:"contact,omitempty"`
	License        *License               `json:"license,omitempty"`
	Version        string                 `json:"version"` // Required.
	MapOfAnything  map[string]interface{} `json:"-"`       // Key must match pattern: `^x-`.
}

Info structure is generated from "#/$defs/info".

func (*Info) ContactEns

func (i *Info) ContactEns() *Contact

ContactEns ensures returned Contact is not nil.

func (*Info) LicenseEns

func (i *Info) LicenseEns() *License

LicenseEns ensures returned License is not nil.

func (Info) MarshalJSON

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

MarshalJSON encodes JSON.

func (*Info) UnmarshalJSON

func (i *Info) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Info) WithContact

func (i *Info) WithContact(val Contact) *Info

WithContact sets Contact value.

func (*Info) WithDescription

func (i *Info) WithDescription(val string) *Info

WithDescription sets Description value.

func (*Info) WithLicense

func (i *Info) WithLicense(val License) *Info

WithLicense sets License value.

func (*Info) WithMapOfAnything

func (i *Info) WithMapOfAnything(val map[string]interface{}) *Info

WithMapOfAnything sets MapOfAnything value.

func (*Info) WithMapOfAnythingItem

func (i *Info) WithMapOfAnythingItem(key string, val interface{}) *Info

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Info) WithSummary

func (i *Info) WithSummary(val string) *Info

WithSummary sets Summary value.

func (*Info) WithTermsOfService

func (i *Info) WithTermsOfService(val string) *Info

WithTermsOfService sets TermsOfService value.

func (*Info) WithTitle

func (i *Info) WithTitle(val string) *Info

WithTitle sets Title value.

func (*Info) WithVersion

func (i *Info) WithVersion(val string) *Info

WithVersion sets Version value.

type License

type License struct {
	Name          string                 `json:"name"` // Required.
	Identifier    *string                `json:"identifier,omitempty"`
	URL           *string                `json:"url,omitempty"` // Format: uri.
	MapOfAnything map[string]interface{} `json:"-"`             // Key must match pattern: `^x-`.
}

License structure is generated from "#/$defs/license".

func (License) MarshalJSON

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

MarshalJSON encodes JSON.

func (*License) UnmarshalJSON

func (l *License) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*License) WithIdentifier

func (l *License) WithIdentifier(val string) *License

WithIdentifier sets Identifier value.

func (*License) WithMapOfAnything

func (l *License) WithMapOfAnything(val map[string]interface{}) *License

WithMapOfAnything sets MapOfAnything value.

func (*License) WithMapOfAnythingItem

func (l *License) WithMapOfAnythingItem(key string, val interface{}) *License

WithMapOfAnythingItem sets MapOfAnything item value.

func (*License) WithName

func (l *License) WithName(val string) *License

WithName sets Name value.

func (*License) WithURL

func (l *License) WithURL(val string) *License

WithURL sets URL value.

type Link struct {
	OperationRef  *string                `json:"operationRef,omitempty"` // Format: uri-reference.
	OperationID   *string                `json:"operationId,omitempty"`
	Parameters    map[string]string      `json:"parameters,omitempty"`
	RequestBody   *interface{}           `json:"requestBody,omitempty"`
	Description   *string                `json:"description,omitempty"`
	Body          *Server                `json:"body,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

Link structure is generated from "#/$defs/link".

func (*Link) BodyEns

func (l *Link) BodyEns() *Server

BodyEns ensures returned Body is not nil.

func (Link) MarshalJSON

func (l Link) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Link) UnmarshalJSON

func (l *Link) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Link) WithBody

func (l *Link) WithBody(val Server) *Link

WithBody sets Body value.

func (*Link) WithDescription

func (l *Link) WithDescription(val string) *Link

WithDescription sets Description value.

func (*Link) WithMapOfAnything

func (l *Link) WithMapOfAnything(val map[string]interface{}) *Link

WithMapOfAnything sets MapOfAnything value.

func (*Link) WithMapOfAnythingItem

func (l *Link) WithMapOfAnythingItem(key string, val interface{}) *Link

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Link) WithOperationID

func (l *Link) WithOperationID(val string) *Link

WithOperationID sets OperationID value.

func (*Link) WithOperationRef

func (l *Link) WithOperationRef(val string) *Link

WithOperationRef sets OperationRef value.

func (*Link) WithParameters

func (l *Link) WithParameters(val map[string]string) *Link

WithParameters sets Parameters value.

func (*Link) WithParametersItem

func (l *Link) WithParametersItem(key string, val string) *Link

WithParametersItem sets Parameters item value.

func (*Link) WithRequestBody

func (l *Link) WithRequestBody(val interface{}) *Link

WithRequestBody sets RequestBody value.

type LinkOrReference

type LinkOrReference struct {
	Reference *Reference `json:"-"`
	Link      *Link      `json:"-"`
}

LinkOrReference structure is generated from "#/$defs/link-or-reference".

func (*LinkOrReference) LinkEns

func (l *LinkOrReference) LinkEns() *Link

LinkEns ensures returned Link is not nil.

func (LinkOrReference) MarshalJSON

func (l LinkOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*LinkOrReference) ReferenceEns

func (l *LinkOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*LinkOrReference) UnmarshalJSON

func (l *LinkOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (l *LinkOrReference) WithLink(val Link) *LinkOrReference

WithLink sets Link value.

func (*LinkOrReference) WithReference

func (l *LinkOrReference) WithReference(val Reference) *LinkOrReference

WithReference sets Reference value.

type MediaType

type MediaType struct {
	Schema        map[string]interface{}        `json:"schema,omitempty"`
	Encoding      map[string]Encoding           `json:"encoding,omitempty"`
	Example       *interface{}                  `json:"example,omitempty"`
	Examples      map[string]ExampleOrReference `json:"examples,omitempty"`
	MapOfAnything map[string]interface{}        `json:"-"` // Key must match pattern: `^x-`.
}

MediaType structure is generated from "#/$defs/media-type".

func (MediaType) MarshalJSON

func (m MediaType) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*MediaType) UnmarshalJSON

func (m *MediaType) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*MediaType) WithEncoding

func (m *MediaType) WithEncoding(val map[string]Encoding) *MediaType

WithEncoding sets Encoding value.

func (*MediaType) WithEncodingItem

func (m *MediaType) WithEncodingItem(key string, val Encoding) *MediaType

WithEncodingItem sets Encoding item value.

func (*MediaType) WithExample

func (m *MediaType) WithExample(val interface{}) *MediaType

WithExample sets Example value.

func (*MediaType) WithExamples

func (m *MediaType) WithExamples(val map[string]ExampleOrReference) *MediaType

WithExamples sets Examples value.

func (*MediaType) WithExamplesItem

func (m *MediaType) WithExamplesItem(key string, val ExampleOrReference) *MediaType

WithExamplesItem sets Examples item value.

func (*MediaType) WithMapOfAnything

func (m *MediaType) WithMapOfAnything(val map[string]interface{}) *MediaType

WithMapOfAnything sets MapOfAnything value.

func (*MediaType) WithMapOfAnythingItem

func (m *MediaType) WithMapOfAnythingItem(key string, val interface{}) *MediaType

WithMapOfAnythingItem sets MapOfAnything item value.

func (*MediaType) WithSchema

func (m *MediaType) WithSchema(val map[string]interface{}) *MediaType

WithSchema sets Schema value.

func (*MediaType) WithSchemaItem

func (m *MediaType) WithSchemaItem(key string, val interface{}) *MediaType

WithSchemaItem sets Schema item value.

type MutualTLS

type MutualTLS struct{}

MutualTLS structure is generated from "#/$defs/security-scheme/oneOf/5".

mutualTLS.

func (MutualTLS) MarshalJSON

func (m MutualTLS) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*MutualTLS) UnmarshalJSON

func (m *MutualTLS) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type OauthFlows

type OauthFlows struct {
	Implicit          *OauthFlowsDefsImplicit          `json:"implicit,omitempty"`
	Password          *OauthFlowsDefsPassword          `json:"password,omitempty"`
	ClientCredentials *OauthFlowsDefsClientCredentials `json:"clientCredentials,omitempty"`
	AuthorizationCode *OauthFlowsDefsAuthorizationCode `json:"authorizationCode,omitempty"`
	MapOfAnything     map[string]interface{}           `json:"-"` // Key must match pattern: `^x-`.
}

OauthFlows structure is generated from "#/$defs/oauth-flows".

func (*OauthFlows) AuthorizationCodeEns

func (o *OauthFlows) AuthorizationCodeEns() *OauthFlowsDefsAuthorizationCode

AuthorizationCodeEns ensures returned AuthorizationCode is not nil.

func (*OauthFlows) ClientCredentialsEns

func (o *OauthFlows) ClientCredentialsEns() *OauthFlowsDefsClientCredentials

ClientCredentialsEns ensures returned ClientCredentials is not nil.

func (*OauthFlows) ImplicitEns

func (o *OauthFlows) ImplicitEns() *OauthFlowsDefsImplicit

ImplicitEns ensures returned Implicit is not nil.

func (OauthFlows) MarshalJSON

func (o OauthFlows) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*OauthFlows) PasswordEns

func (o *OauthFlows) PasswordEns() *OauthFlowsDefsPassword

PasswordEns ensures returned Password is not nil.

func (*OauthFlows) UnmarshalJSON

func (o *OauthFlows) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*OauthFlows) WithAuthorizationCode

func (o *OauthFlows) WithAuthorizationCode(val OauthFlowsDefsAuthorizationCode) *OauthFlows

WithAuthorizationCode sets AuthorizationCode value.

func (*OauthFlows) WithClientCredentials

func (o *OauthFlows) WithClientCredentials(val OauthFlowsDefsClientCredentials) *OauthFlows

WithClientCredentials sets ClientCredentials value.

func (*OauthFlows) WithImplicit

func (o *OauthFlows) WithImplicit(val OauthFlowsDefsImplicit) *OauthFlows

WithImplicit sets Implicit value.

func (*OauthFlows) WithMapOfAnything

func (o *OauthFlows) WithMapOfAnything(val map[string]interface{}) *OauthFlows

WithMapOfAnything sets MapOfAnything value.

func (*OauthFlows) WithMapOfAnythingItem

func (o *OauthFlows) WithMapOfAnythingItem(key string, val interface{}) *OauthFlows

WithMapOfAnythingItem sets MapOfAnything item value.

func (*OauthFlows) WithPassword

func (o *OauthFlows) WithPassword(val OauthFlowsDefsPassword) *OauthFlows

WithPassword sets Password value.

type OauthFlowsDefsAuthorizationCode

type OauthFlowsDefsAuthorizationCode struct {
	// Format: uri.
	// Required.
	AuthorizationURL string `json:"authorizationUrl"`
	// Format: uri.
	// Required.
	TokenURL      string                 `json:"tokenUrl"`
	RefreshURL    *string                `json:"refreshUrl,omitempty"` // Format: uri.
	Scopes        map[string]string      `json:"scopes"`               // Required.
	MapOfAnything map[string]interface{} `json:"-"`                    // Key must match pattern: `^x-`.
}

OauthFlowsDefsAuthorizationCode structure is generated from "#/$defs/oauth-flows/$defs/authorization-code".

func (OauthFlowsDefsAuthorizationCode) MarshalJSON

func (o OauthFlowsDefsAuthorizationCode) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*OauthFlowsDefsAuthorizationCode) UnmarshalJSON

func (o *OauthFlowsDefsAuthorizationCode) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*OauthFlowsDefsAuthorizationCode) WithAuthorizationURL

WithAuthorizationURL sets AuthorizationURL value.

func (*OauthFlowsDefsAuthorizationCode) WithMapOfAnything

func (o *OauthFlowsDefsAuthorizationCode) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsAuthorizationCode

WithMapOfAnything sets MapOfAnything value.

func (*OauthFlowsDefsAuthorizationCode) WithMapOfAnythingItem

func (o *OauthFlowsDefsAuthorizationCode) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsAuthorizationCode

WithMapOfAnythingItem sets MapOfAnything item value.

func (*OauthFlowsDefsAuthorizationCode) WithRefreshURL

WithRefreshURL sets RefreshURL value.

func (*OauthFlowsDefsAuthorizationCode) WithScopes

WithScopes sets Scopes value.

func (*OauthFlowsDefsAuthorizationCode) WithScopesItem

WithScopesItem sets Scopes item value.

func (*OauthFlowsDefsAuthorizationCode) WithTokenURL

WithTokenURL sets TokenURL value.

type OauthFlowsDefsClientCredentials

type OauthFlowsDefsClientCredentials struct {
	// Format: uri.
	// Required.
	TokenURL      string                 `json:"tokenUrl"`
	RefreshURL    *string                `json:"refreshUrl,omitempty"` // Format: uri.
	Scopes        map[string]string      `json:"scopes"`               // Required.
	MapOfAnything map[string]interface{} `json:"-"`                    // Key must match pattern: `^x-`.
}

OauthFlowsDefsClientCredentials structure is generated from "#/$defs/oauth-flows/$defs/client-credentials".

func (OauthFlowsDefsClientCredentials) MarshalJSON

func (o OauthFlowsDefsClientCredentials) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*OauthFlowsDefsClientCredentials) UnmarshalJSON

func (o *OauthFlowsDefsClientCredentials) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*OauthFlowsDefsClientCredentials) WithMapOfAnything

func (o *OauthFlowsDefsClientCredentials) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsClientCredentials

WithMapOfAnything sets MapOfAnything value.

func (*OauthFlowsDefsClientCredentials) WithMapOfAnythingItem

func (o *OauthFlowsDefsClientCredentials) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsClientCredentials

WithMapOfAnythingItem sets MapOfAnything item value.

func (*OauthFlowsDefsClientCredentials) WithRefreshURL

WithRefreshURL sets RefreshURL value.

func (*OauthFlowsDefsClientCredentials) WithScopes

WithScopes sets Scopes value.

func (*OauthFlowsDefsClientCredentials) WithScopesItem

WithScopesItem sets Scopes item value.

func (*OauthFlowsDefsClientCredentials) WithTokenURL

WithTokenURL sets TokenURL value.

type OauthFlowsDefsImplicit

type OauthFlowsDefsImplicit struct {
	// Format: uri.
	// Required.
	AuthorizationURL string                 `json:"authorizationUrl"`
	RefreshURL       *string                `json:"refreshUrl,omitempty"` // Format: uri.
	Scopes           map[string]string      `json:"scopes"`               // Required.
	MapOfAnything    map[string]interface{} `json:"-"`                    // Key must match pattern: `^x-`.
}

OauthFlowsDefsImplicit structure is generated from "#/$defs/oauth-flows/$defs/implicit".

func (OauthFlowsDefsImplicit) MarshalJSON

func (o OauthFlowsDefsImplicit) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*OauthFlowsDefsImplicit) UnmarshalJSON

func (o *OauthFlowsDefsImplicit) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*OauthFlowsDefsImplicit) WithAuthorizationURL

func (o *OauthFlowsDefsImplicit) WithAuthorizationURL(val string) *OauthFlowsDefsImplicit

WithAuthorizationURL sets AuthorizationURL value.

func (*OauthFlowsDefsImplicit) WithMapOfAnything

func (o *OauthFlowsDefsImplicit) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsImplicit

WithMapOfAnything sets MapOfAnything value.

func (*OauthFlowsDefsImplicit) WithMapOfAnythingItem

func (o *OauthFlowsDefsImplicit) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsImplicit

WithMapOfAnythingItem sets MapOfAnything item value.

func (*OauthFlowsDefsImplicit) WithRefreshURL

func (o *OauthFlowsDefsImplicit) WithRefreshURL(val string) *OauthFlowsDefsImplicit

WithRefreshURL sets RefreshURL value.

func (*OauthFlowsDefsImplicit) WithScopes

WithScopes sets Scopes value.

func (*OauthFlowsDefsImplicit) WithScopesItem

func (o *OauthFlowsDefsImplicit) WithScopesItem(key string, val string) *OauthFlowsDefsImplicit

WithScopesItem sets Scopes item value.

type OauthFlowsDefsPassword

type OauthFlowsDefsPassword struct {
	// Format: uri.
	// Required.
	TokenURL      string                 `json:"tokenUrl"`
	RefreshURL    *string                `json:"refreshUrl,omitempty"` // Format: uri.
	Scopes        map[string]string      `json:"scopes"`               // Required.
	MapOfAnything map[string]interface{} `json:"-"`                    // Key must match pattern: `^x-`.
}

OauthFlowsDefsPassword structure is generated from "#/$defs/oauth-flows/$defs/password".

func (OauthFlowsDefsPassword) MarshalJSON

func (o OauthFlowsDefsPassword) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*OauthFlowsDefsPassword) UnmarshalJSON

func (o *OauthFlowsDefsPassword) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*OauthFlowsDefsPassword) WithMapOfAnything

func (o *OauthFlowsDefsPassword) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsPassword

WithMapOfAnything sets MapOfAnything value.

func (*OauthFlowsDefsPassword) WithMapOfAnythingItem

func (o *OauthFlowsDefsPassword) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsPassword

WithMapOfAnythingItem sets MapOfAnything item value.

func (*OauthFlowsDefsPassword) WithRefreshURL

func (o *OauthFlowsDefsPassword) WithRefreshURL(val string) *OauthFlowsDefsPassword

WithRefreshURL sets RefreshURL value.

func (*OauthFlowsDefsPassword) WithScopes

WithScopes sets Scopes value.

func (*OauthFlowsDefsPassword) WithScopesItem

func (o *OauthFlowsDefsPassword) WithScopesItem(key string, val string) *OauthFlowsDefsPassword

WithScopesItem sets Scopes item value.

func (*OauthFlowsDefsPassword) WithTokenURL

WithTokenURL sets TokenURL value.

type Operation

type Operation struct {
	Tags          []string                        `json:"tags,omitempty"`
	Summary       *string                         `json:"summary,omitempty"`
	Description   *string                         `json:"description,omitempty"`
	ExternalDocs  *ExternalDocumentation          `json:"externalDocs,omitempty"`
	ID            *string                         `json:"operationId,omitempty"`
	Parameters    []ParameterOrReference          `json:"parameters,omitempty"`
	RequestBody   *RequestBodyOrReference         `json:"requestBody,omitempty"`
	Responses     *Responses                      `json:"responses,omitempty"`
	Callbacks     map[string]CallbacksOrReference `json:"callbacks,omitempty"`
	Deprecated    *bool                           `json:"deprecated,omitempty"`
	Security      []map[string][]string           `json:"security,omitempty"`
	Servers       []Server                        `json:"servers,omitempty"`
	MapOfAnything map[string]interface{}          `json:"-"` // Key must match pattern: `^x-`.
}

Operation structure is generated from "#/$defs/operation".

func (*Operation) ExternalDocsEns

func (o *Operation) ExternalDocsEns() *ExternalDocumentation

ExternalDocsEns ensures returned ExternalDocs is not nil.

func (Operation) MarshalJSON

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

MarshalJSON encodes JSON.

func (*Operation) RequestBodyEns

func (o *Operation) RequestBodyEns() *RequestBodyOrReference

RequestBodyEns ensures returned RequestBody is not nil.

func (*Operation) ResponsesEns

func (o *Operation) ResponsesEns() *Responses

ResponsesEns ensures returned Responses is not nil.

func (Operation) UnknownParamIsForbidden

func (o Operation) UnknownParamIsForbidden(in ParameterIn) bool

UnknownParamIsForbidden indicates forbidden unknown parameters.

func (*Operation) UnmarshalJSON

func (o *Operation) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Operation) WithCallbacks

func (o *Operation) WithCallbacks(val map[string]CallbacksOrReference) *Operation

WithCallbacks sets Callbacks value.

func (*Operation) WithCallbacksItem

func (o *Operation) WithCallbacksItem(key string, val CallbacksOrReference) *Operation

WithCallbacksItem sets Callbacks item value.

func (*Operation) WithDeprecated

func (o *Operation) WithDeprecated(val bool) *Operation

WithDeprecated sets Deprecated value.

func (*Operation) WithDescription

func (o *Operation) WithDescription(val string) *Operation

WithDescription sets Description value.

func (*Operation) WithExternalDocs

func (o *Operation) WithExternalDocs(val ExternalDocumentation) *Operation

WithExternalDocs sets ExternalDocs value.

func (*Operation) WithID

func (o *Operation) WithID(val string) *Operation

WithID sets ID value.

func (*Operation) WithMapOfAnything

func (o *Operation) WithMapOfAnything(val map[string]interface{}) *Operation

WithMapOfAnything sets MapOfAnything value.

func (*Operation) WithMapOfAnythingItem

func (o *Operation) WithMapOfAnythingItem(key string, val interface{}) *Operation

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Operation) WithParameters

func (o *Operation) WithParameters(val ...ParameterOrReference) *Operation

WithParameters sets Parameters value.

func (*Operation) WithRequestBody

func (o *Operation) WithRequestBody(val RequestBodyOrReference) *Operation

WithRequestBody sets RequestBody value.

func (*Operation) WithResponses

func (o *Operation) WithResponses(val Responses) *Operation

WithResponses sets Responses value.

func (*Operation) WithSecurity

func (o *Operation) WithSecurity(val ...map[string][]string) *Operation

WithSecurity sets Security value.

func (*Operation) WithServers

func (o *Operation) WithServers(val ...Server) *Operation

WithServers sets Servers value.

func (*Operation) WithSummary

func (o *Operation) WithSummary(val string) *Operation

WithSummary sets Summary value.

func (*Operation) WithTags

func (o *Operation) WithTags(val ...string) *Operation

WithTags sets Tags value.

type OperationExposer

type OperationExposer interface {
	Operation() *Operation
}

OperationExposer grants access to underlying *Operation.

type Parameter

type Parameter struct {
	Name          string                        `json:"name"` // Required.
	In            ParameterIn                   `json:"in"`   // Required.
	Description   *string                       `json:"description,omitempty"`
	Required      *bool                         `json:"required,omitempty"`
	Deprecated    *bool                         `json:"deprecated,omitempty"`
	Schema        map[string]interface{}        `json:"schema,omitempty"`
	Content       map[string]MediaType          `json:"content,omitempty"`
	Style         *ParameterStyle               `json:"style,omitempty"`
	Explode       *bool                         `json:"explode,omitempty"`
	Example       *interface{}                  `json:"example,omitempty"`
	Examples      map[string]ExampleOrReference `json:"examples,omitempty"`
	MapOfAnything map[string]interface{}        `json:"-"` // Key must match pattern: `^x-`.
}

Parameter structure is generated from "#/$defs/parameter".

func (Parameter) MarshalJSON

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

MarshalJSON encodes JSON.

func (Parameter) ToParameterOrRef

func (p Parameter) ToParameterOrRef() ParameterOrReference

ToParameterOrRef exposes Parameter in general form.

func (*Parameter) UnmarshalJSON

func (p *Parameter) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Parameter) WithContent

func (p *Parameter) WithContent(val map[string]MediaType) *Parameter

WithContent sets Content value.

func (*Parameter) WithContentItem

func (p *Parameter) WithContentItem(key string, val MediaType) *Parameter

WithContentItem sets Content item value.

func (*Parameter) WithDeprecated

func (p *Parameter) WithDeprecated(val bool) *Parameter

WithDeprecated sets Deprecated value.

func (*Parameter) WithDescription

func (p *Parameter) WithDescription(val string) *Parameter

WithDescription sets Description value.

func (*Parameter) WithExample

func (p *Parameter) WithExample(val interface{}) *Parameter

WithExample sets Example value.

func (*Parameter) WithExamples

func (p *Parameter) WithExamples(val map[string]ExampleOrReference) *Parameter

WithExamples sets Examples value.

func (*Parameter) WithExamplesItem

func (p *Parameter) WithExamplesItem(key string, val ExampleOrReference) *Parameter

WithExamplesItem sets Examples item value.

func (*Parameter) WithExplode

func (p *Parameter) WithExplode(val bool) *Parameter

WithExplode sets Explode value.

func (*Parameter) WithIn

func (p *Parameter) WithIn(val ParameterIn) *Parameter

WithIn sets In value.

func (*Parameter) WithMapOfAnything

func (p *Parameter) WithMapOfAnything(val map[string]interface{}) *Parameter

WithMapOfAnything sets MapOfAnything value.

func (*Parameter) WithMapOfAnythingItem

func (p *Parameter) WithMapOfAnythingItem(key string, val interface{}) *Parameter

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Parameter) WithName

func (p *Parameter) WithName(val string) *Parameter

WithName sets Name value.

func (*Parameter) WithRequired

func (p *Parameter) WithRequired(val bool) *Parameter

WithRequired sets Required value.

func (*Parameter) WithSchema

func (p *Parameter) WithSchema(val map[string]interface{}) *Parameter

WithSchema sets Schema value.

func (*Parameter) WithSchemaItem

func (p *Parameter) WithSchemaItem(key string, val interface{}) *Parameter

WithSchemaItem sets Schema item value.

func (*Parameter) WithStyle

func (p *Parameter) WithStyle(val ParameterStyle) *Parameter

WithStyle sets Style value.

type ParameterIn

type ParameterIn string

ParameterIn is an enum type.

func (ParameterIn) MarshalJSON

func (i ParameterIn) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ParameterIn) UnmarshalJSON

func (i *ParameterIn) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type ParameterOrReference

type ParameterOrReference struct {
	Reference *Reference `json:"-"`
	Parameter *Parameter `json:"-"`
}

ParameterOrReference structure is generated from "#/$defs/parameter-or-reference".

func (ParameterOrReference) MarshalJSON

func (p ParameterOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ParameterOrReference) ParameterEns

func (p *ParameterOrReference) ParameterEns() *Parameter

ParameterEns ensures returned Parameter is not nil.

func (*ParameterOrReference) ReferenceEns

func (p *ParameterOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*ParameterOrReference) UnmarshalJSON

func (p *ParameterOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ParameterOrReference) WithParameter

func (p *ParameterOrReference) WithParameter(val Parameter) *ParameterOrReference

WithParameter sets Parameter value.

func (*ParameterOrReference) WithReference

func (p *ParameterOrReference) WithReference(val Reference) *ParameterOrReference

WithReference sets Reference value.

type ParameterStyle

type ParameterStyle string

ParameterStyle is an enum type.

func (ParameterStyle) MarshalJSON

func (i ParameterStyle) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ParameterStyle) UnmarshalJSON

func (i *ParameterStyle) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type PathItem

type PathItem struct {
	Summary       *string                `json:"summary,omitempty"`
	Description   *string                `json:"description,omitempty"`
	Servers       []Server               `json:"servers,omitempty"`
	Parameters    []ParameterOrReference `json:"parameters,omitempty"`
	Get           *Operation             `json:"get,omitempty"`
	Put           *Operation             `json:"put,omitempty"`
	Post          *Operation             `json:"post,omitempty"`
	Delete        *Operation             `json:"delete,omitempty"`
	Options       *Operation             `json:"options,omitempty"`
	Head          *Operation             `json:"head,omitempty"`
	Patch         *Operation             `json:"patch,omitempty"`
	Trace         *Operation             `json:"trace,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

PathItem structure is generated from "#/$defs/path-item".

func (*PathItem) DeleteEns

func (p *PathItem) DeleteEns() *Operation

DeleteEns ensures returned Delete is not nil.

func (*PathItem) GetEns

func (p *PathItem) GetEns() *Operation

GetEns ensures returned Get is not nil.

func (*PathItem) HeadEns

func (p *PathItem) HeadEns() *Operation

HeadEns ensures returned Head is not nil.

func (PathItem) MarshalJSON

func (p PathItem) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (PathItem) Operation

func (p PathItem) Operation(method string) (*Operation, error)

Operation retrieves method Operation from PathItem.

func (*PathItem) OptionsEns

func (p *PathItem) OptionsEns() *Operation

OptionsEns ensures returned Options is not nil.

func (*PathItem) PatchEns

func (p *PathItem) PatchEns() *Operation

PatchEns ensures returned Patch is not nil.

func (*PathItem) PostEns

func (p *PathItem) PostEns() *Operation

PostEns ensures returned Post is not nil.

func (*PathItem) PutEns

func (p *PathItem) PutEns() *Operation

PutEns ensures returned Put is not nil.

func (*PathItem) SetOperation

func (p *PathItem) SetOperation(method string, op *Operation) error

SetOperation sets a method Operation to PathItem.

func (*PathItem) TraceEns

func (p *PathItem) TraceEns() *Operation

TraceEns ensures returned Trace is not nil.

func (*PathItem) UnmarshalJSON

func (p *PathItem) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*PathItem) WithDelete

func (p *PathItem) WithDelete(val Operation) *PathItem

WithDelete sets Delete value.

func (*PathItem) WithDescription

func (p *PathItem) WithDescription(val string) *PathItem

WithDescription sets Description value.

func (*PathItem) WithGet

func (p *PathItem) WithGet(val Operation) *PathItem

WithGet sets Get value.

func (*PathItem) WithHead

func (p *PathItem) WithHead(val Operation) *PathItem

WithHead sets Head value.

func (*PathItem) WithMapOfAnything

func (p *PathItem) WithMapOfAnything(val map[string]interface{}) *PathItem

WithMapOfAnything sets MapOfAnything value.

func (*PathItem) WithMapOfAnythingItem

func (p *PathItem) WithMapOfAnythingItem(key string, val interface{}) *PathItem

WithMapOfAnythingItem sets MapOfAnything item value.

func (*PathItem) WithOptions

func (p *PathItem) WithOptions(val Operation) *PathItem

WithOptions sets Options value.

func (*PathItem) WithParameters

func (p *PathItem) WithParameters(val ...ParameterOrReference) *PathItem

WithParameters sets Parameters value.

func (*PathItem) WithPatch

func (p *PathItem) WithPatch(val Operation) *PathItem

WithPatch sets Patch value.

func (*PathItem) WithPost

func (p *PathItem) WithPost(val Operation) *PathItem

WithPost sets Post value.

func (*PathItem) WithPut

func (p *PathItem) WithPut(val Operation) *PathItem

WithPut sets Put value.

func (*PathItem) WithServers

func (p *PathItem) WithServers(val ...Server) *PathItem

WithServers sets Servers value.

func (*PathItem) WithSummary

func (p *PathItem) WithSummary(val string) *PathItem

WithSummary sets Summary value.

func (*PathItem) WithTrace

func (p *PathItem) WithTrace(val Operation) *PathItem

WithTrace sets Trace value.

type PathItemOrReference

type PathItemOrReference struct {
	Reference *Reference `json:"-"`
	PathItem  *PathItem  `json:"-"`
}

PathItemOrReference structure is generated from "#/$defs/path-item-or-reference".

func (PathItemOrReference) MarshalJSON

func (p PathItemOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*PathItemOrReference) PathItemEns

func (p *PathItemOrReference) PathItemEns() *PathItem

PathItemEns ensures returned PathItem is not nil.

func (*PathItemOrReference) ReferenceEns

func (p *PathItemOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*PathItemOrReference) UnmarshalJSON

func (p *PathItemOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*PathItemOrReference) WithPathItem

func (p *PathItemOrReference) WithPathItem(val PathItem) *PathItemOrReference

WithPathItem sets PathItem value.

func (*PathItemOrReference) WithReference

func (p *PathItemOrReference) WithReference(val Reference) *PathItemOrReference

WithReference sets Reference value.

type Paths

type Paths struct {
	MapOfPathItemValues map[string]PathItem    `json:"-"` // Key must match pattern: `^/`.
	MapOfAnything       map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

Paths structure is generated from "#/$defs/paths".

func (Paths) MarshalJSON

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

MarshalJSON encodes JSON.

func (*Paths) UnmarshalJSON

func (p *Paths) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Paths) WithMapOfAnything

func (p *Paths) WithMapOfAnything(val map[string]interface{}) *Paths

WithMapOfAnything sets MapOfAnything value.

func (*Paths) WithMapOfAnythingItem

func (p *Paths) WithMapOfAnythingItem(key string, val interface{}) *Paths

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Paths) WithMapOfPathItemValues

func (p *Paths) WithMapOfPathItemValues(val map[string]PathItem) *Paths

WithMapOfPathItemValues sets MapOfPathItemValues value.

func (*Paths) WithMapOfPathItemValuesItem

func (p *Paths) WithMapOfPathItemValuesItem(key string, val PathItem) *Paths

WithMapOfPathItemValuesItem sets MapOfPathItemValues item value.

type Reference

type Reference struct {
	// Format: uri-reference.
	// Required.
	Ref         string  `json:"$ref"`
	Summary     *string `json:"summary,omitempty"`
	Description *string `json:"description,omitempty"`
}

Reference structure is generated from "#/$defs/reference".

func (*Reference) UnmarshalJSON

func (r *Reference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Reference) WithDescription

func (r *Reference) WithDescription(val string) *Reference

WithDescription sets Description value.

func (*Reference) WithRef

func (r *Reference) WithRef(val string) *Reference

WithRef sets Ref value.

func (*Reference) WithSummary

func (r *Reference) WithSummary(val string) *Reference

WithSummary sets Summary value.

type Reflector

type Reflector struct {
	jsonschema.Reflector
	Spec *Spec
}

Reflector builds OpenAPI Schema with reflected structures.

Example (Options)
r := openapi31.Reflector{}

// Reflector embeds jsonschema.Reflector and it is possible to configure optional behavior.
r.Reflector.DefaultOptions = append(r.Reflector.DefaultOptions,
	jsonschema.InterceptNullability(func(params jsonschema.InterceptNullabilityParams) {
		// Removing nullability from non-pointer slices (regardless of omitempty).
		if params.Type.Kind() != reflect.Ptr && params.Schema.HasType(jsonschema.Null) && params.Schema.HasType(jsonschema.Array) {
			*params.Schema.Type = jsonschema.Array.Type()
		}
	}))

type req struct {
	Foo []int `json:"foo"`
}

oc, _ := r.NewOperationContext(http.MethodPost, "/foo")
oc.AddReqStructure(new(req))

_ = r.AddOperation(oc)

j, _ := assertjson.MarshalIndentCompact(r.Spec, "", " ", 120)

fmt.Println(string(j))
Output:

{
 "openapi":"3.1.0","info":{"title":"","version":""},
 "paths":{
  "/foo":{
   "post":{
    "requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Openapi31TestReq"}}}},
    "responses":{"204":{"description":"No Content"}}
   }
  }
 },
 "components":{"schemas":{"Openapi31TestReq":{"properties":{"foo":{"items":{"type":"integer"},"type":"array"}},"type":"object"}}}
}

func NewReflector

func NewReflector() *Reflector

NewReflector creates an instance of OpenAPI 3.1 reflector.

func (*Reflector) AddOperation

func (r *Reflector) AddOperation(oc openapi.OperationContext) error

AddOperation configures operation request and response schema.

Example
reflector := openapi31.NewReflector()
reflector.Spec.Info.
	WithTitle("Things API").
	WithVersion("1.2.3").
	WithDescription("Put something here")

type req struct {
	ID     string `path:"id" example:"XXX-XXXXX"`
	Locale string `query:"locale" pattern:"^[a-z]{2}-[A-Z]{2}$"`
	Title  string `json:"string"`
	Amount uint   `json:"amount"`
	Items  []struct {
		Count uint   `json:"count"`
		Name  string `json:"name"`
	} `json:"items,omitempty"`
}

type resp struct {
	ID     string `json:"id" example:"XXX-XXXXX"`
	Amount uint   `json:"amount"`
	Items  []struct {
		Count uint   `json:"count"`
		Name  string `json:"name"`
	} `json:"items,omitempty"`
	UpdatedAt time.Time `json:"updated_at"`
}

putOp, _ := reflector.NewOperationContext(http.MethodPut, "/things/{id}")

putOp.AddReqStructure(new(req))
putOp.AddRespStructure(new(resp))
putOp.AddRespStructure(new([]resp), openapi.WithHTTPStatus(http.StatusConflict))
handleError(reflector.AddOperation(putOp))

getOp, _ := reflector.NewOperationContext(http.MethodGet, "/things/{id}")
getOp.AddReqStructure(new(req))
getOp.AddRespStructure(new(resp))
handleError(reflector.AddOperation(getOp))

schema, err := reflector.Spec.MarshalYAML()
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(schema))
Output:

openapi: 3.1.0
info:
  description: Put something here
  title: Things API
  version: 1.2.3
paths:
  /things/{id}:
    get:
      parameters:
      - in: query
        name: locale
        schema:
          pattern: ^[a-z]{2}-[A-Z]{2}$
          type: string
      - in: path
        name: id
        required: true
        schema:
          examples:
          - XXX-XXXXX
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Openapi31TestResp'
          description: OK
    put:
      parameters:
      - in: query
        name: locale
        schema:
          pattern: ^[a-z]{2}-[A-Z]{2}$
          type: string
      - in: path
        name: id
        required: true
        schema:
          examples:
          - XXX-XXXXX
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Openapi31TestReq'
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Openapi31TestResp'
          description: OK
        "409":
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/Openapi31TestResp'
                type:
                - "null"
                - array
          description: Conflict
components:
  schemas:
    Openapi31TestReq:
      properties:
        amount:
          minimum: 0
          type: integer
        items:
          items:
            properties:
              count:
                minimum: 0
                type: integer
              name:
                type: string
            type: object
          type: array
        string:
          type: string
      type: object
    Openapi31TestResp:
      properties:
        amount:
          minimum: 0
          type: integer
        id:
          examples:
          - XXX-XXXXX
          type: string
        items:
          items:
            properties:
              count:
                minimum: 0
                type: integer
              name:
                type: string
            type: object
          type: array
        updated_at:
          format: date-time
          type: string
      type: object
Example (QueryObject)
package main

import (
	"fmt"
	"log"
	"net/http"

	"github.com/STARRISEPH/openapi-go/openapi31"
)

func main() {
	reflector := openapi31.NewReflector()
	reflector.Spec.Info.
		WithTitle("Things API").
		WithVersion("1.2.3").
		WithDescription("Put something here")

	type jsonFilter struct {
		Foo    string `json:"foo"`
		Bar    int    `json:"bar"`
		Deeper struct {
			Val string `json:"val"`
		} `json:"deeper"`
	}

	type deepObjectFilter struct {
		Baz    bool    `query:"baz"`
		Quux   float64 `query:"quux"`
		Deeper struct {
			Val string `query:"val"`
		} `query:"deeper"`
	}

	type req struct {
		ID     string `path:"id" example:"XXX-XXXXX"`
		Locale string `query:"locale" pattern:"^[a-z]{2}-[A-Z]{2}$"`
		// Object values can be serialized in JSON (with json field tags in the value struct).
		JSONFilter jsonFilter `query:"json_filter"`
		// Or as deepObject (with same field tag as parent, .e.g query).
		DeepObjectFilter deepObjectFilter `query:"deep_object_filter"`
	}

	getOp, _ := reflector.NewOperationContext(http.MethodGet, "/things/{id}")

	getOp.AddReqStructure(new(req))
	_ = reflector.AddOperation(getOp)

	schema, err := reflector.Spec.MarshalYAML()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(string(schema))

}
Output:

openapi: 3.1.0
info:
  description: Put something here
  title: Things API
  version: 1.2.3
paths:
  /things/{id}:
    get:
      parameters:
      - in: query
        name: locale
        schema:
          pattern: ^[a-z]{2}-[A-Z]{2}$
          type: string
      - content:
          application/json:
            schema:
              $ref: '#/components/schemas/Openapi31TestJsonFilter'
        in: query
        name: json_filter
      - explode: true
        in: query
        name: deep_object_filter
        schema:
          $ref: '#/components/schemas/Openapi31TestDeepObjectFilter'
        style: deepObject
      - in: path
        name: id
        required: true
        schema:
          examples:
          - XXX-XXXXX
          type: string
      responses:
        "204":
          description: No Content
components:
  schemas:
    Openapi31TestDeepObjectFilter:
      properties:
        baz:
          type: boolean
        deeper:
          properties:
            val:
              type: string
          type: object
        quux:
          type: number
      type: object
    Openapi31TestJsonFilter:
      properties:
        bar:
          type: integer
        deeper:
          properties:
            val:
              type: string
          type: object
        foo:
          type: string
      type: object

func (*Reflector) JSONSchemaReflector

func (r *Reflector) JSONSchemaReflector() *jsonschema.Reflector

JSONSchemaReflector provides access to a low-level struct reflector.

func (*Reflector) NewOperationContext

func (r *Reflector) NewOperationContext(method, pathPattern string) (openapi.OperationContext, error)

NewOperationContext initializes openapi.OperationContext to be prepared and added later with Reflector.AddOperation.

func (*Reflector) ResolveJSONSchemaRef

func (r *Reflector) ResolveJSONSchemaRef(ref string) (s jsonschema.SchemaOrBool, found bool)

ResolveJSONSchemaRef builds JSON Schema from OpenAPI Component Schema reference.

Can be used in jsonschema.Schema IsTrivial().

func (*Reflector) SpecEns

func (r *Reflector) SpecEns() *Spec

SpecEns ensures returned Spec is not nil.

func (*Reflector) SpecSchema

func (r *Reflector) SpecSchema() openapi.SpecSchema

SpecSchema returns OpenAPI spec schema.

func (*Reflector) WalkRequestJSONSchemas

func (r *Reflector) WalkRequestJSONSchemas(
	method string,
	cu openapi.ContentUnit,
	cb openapi.JSONSchemaCallback,
	done func(oc openapi.OperationContext),
) error

WalkRequestJSONSchemas iterates over request parameters of a ContentUnit and call user function for param schemas.

func (*Reflector) WalkResponseJSONSchemas

func (r *Reflector) WalkResponseJSONSchemas(cu openapi.ContentUnit, cb openapi.JSONSchemaCallback, done func(oc openapi.OperationContext)) error

WalkResponseJSONSchemas provides JSON schemas for response structure.

type RequestBody

type RequestBody struct {
	Description   *string                `json:"description,omitempty"`
	Content       map[string]MediaType   `json:"content"` // Required.
	Required      *bool                  `json:"required,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

RequestBody structure is generated from "#/$defs/request-body".

func (RequestBody) MarshalJSON

func (r RequestBody) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*RequestBody) UnmarshalJSON

func (r *RequestBody) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*RequestBody) WithContent

func (r *RequestBody) WithContent(val map[string]MediaType) *RequestBody

WithContent sets Content value.

func (*RequestBody) WithContentItem

func (r *RequestBody) WithContentItem(key string, val MediaType) *RequestBody

WithContentItem sets Content item value.

func (*RequestBody) WithDescription

func (r *RequestBody) WithDescription(val string) *RequestBody

WithDescription sets Description value.

func (*RequestBody) WithMapOfAnything

func (r *RequestBody) WithMapOfAnything(val map[string]interface{}) *RequestBody

WithMapOfAnything sets MapOfAnything value.

func (*RequestBody) WithMapOfAnythingItem

func (r *RequestBody) WithMapOfAnythingItem(key string, val interface{}) *RequestBody

WithMapOfAnythingItem sets MapOfAnything item value.

func (*RequestBody) WithRequired

func (r *RequestBody) WithRequired(val bool) *RequestBody

WithRequired sets Required value.

type RequestBodyOrReference

type RequestBodyOrReference struct {
	Reference   *Reference   `json:"-"`
	RequestBody *RequestBody `json:"-"`
}

RequestBodyOrReference structure is generated from "#/$defs/request-body-or-reference".

func (RequestBodyOrReference) MarshalJSON

func (r RequestBodyOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*RequestBodyOrReference) ReferenceEns

func (r *RequestBodyOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*RequestBodyOrReference) RequestBodyEns

func (r *RequestBodyOrReference) RequestBodyEns() *RequestBody

RequestBodyEns ensures returned RequestBody is not nil.

func (*RequestBodyOrReference) UnmarshalJSON

func (r *RequestBodyOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*RequestBodyOrReference) WithReference

WithReference sets Reference value.

func (*RequestBodyOrReference) WithRequestBody

WithRequestBody sets RequestBody value.

type Response

type Response struct {
	Description   string                       `json:"description"` // Required.
	Headers       map[string]HeaderOrReference `json:"headers,omitempty"`
	Content       map[string]MediaType         `json:"content,omitempty"`
	Links         map[string]LinkOrReference   `json:"links,omitempty"`
	MapOfAnything map[string]interface{}       `json:"-"` // Key must match pattern: `^x-`.
}

Response structure is generated from "#/$defs/response".

func (Response) MarshalJSON

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

MarshalJSON encodes JSON.

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Response) WithContent

func (r *Response) WithContent(val map[string]MediaType) *Response

WithContent sets Content value.

func (*Response) WithContentItem

func (r *Response) WithContentItem(key string, val MediaType) *Response

WithContentItem sets Content item value.

func (*Response) WithDescription

func (r *Response) WithDescription(val string) *Response

WithDescription sets Description value.

func (*Response) WithHeaders

func (r *Response) WithHeaders(val map[string]HeaderOrReference) *Response

WithHeaders sets Headers value.

func (*Response) WithHeadersItem

func (r *Response) WithHeadersItem(key string, val HeaderOrReference) *Response

WithHeadersItem sets Headers item value.

func (r *Response) WithLinks(val map[string]LinkOrReference) *Response

WithLinks sets Links value.

func (*Response) WithLinksItem

func (r *Response) WithLinksItem(key string, val LinkOrReference) *Response

WithLinksItem sets Links item value.

func (*Response) WithMapOfAnything

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

WithMapOfAnything sets MapOfAnything value.

func (*Response) WithMapOfAnythingItem

func (r *Response) WithMapOfAnythingItem(key string, val interface{}) *Response

WithMapOfAnythingItem sets MapOfAnything item value.

type ResponseOrReference

type ResponseOrReference struct {
	Reference *Reference `json:"-"`
	Response  *Response  `json:"-"`
}

ResponseOrReference structure is generated from "#/$defs/response-or-reference".

func (ResponseOrReference) MarshalJSON

func (r ResponseOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ResponseOrReference) ReferenceEns

func (r *ResponseOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*ResponseOrReference) ResponseEns

func (r *ResponseOrReference) ResponseEns() *Response

ResponseEns ensures returned Response is not nil.

func (*ResponseOrReference) UnmarshalJSON

func (r *ResponseOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ResponseOrReference) WithReference

func (r *ResponseOrReference) WithReference(val Reference) *ResponseOrReference

WithReference sets Reference value.

func (*ResponseOrReference) WithResponse

func (r *ResponseOrReference) WithResponse(val Response) *ResponseOrReference

WithResponse sets Response value.

type Responses

type Responses struct {
	Default                        *ResponseOrReference           `json:"default,omitempty"`
	MapOfResponseOrReferenceValues map[string]ResponseOrReference `json:"-"` // Key must match pattern: `^[1-5](?:[0-9]{2}|XX)$`.
	MapOfAnything                  map[string]interface{}         `json:"-"` // Key must match pattern: `^x-`.
}

Responses structure is generated from "#/$defs/responses".

func (*Responses) DefaultEns

func (r *Responses) DefaultEns() *ResponseOrReference

DefaultEns ensures returned Default is not nil.

func (Responses) MarshalJSON

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

MarshalJSON encodes JSON.

func (*Responses) UnmarshalJSON

func (r *Responses) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Responses) WithDefault

func (r *Responses) WithDefault(val ResponseOrReference) *Responses

WithDefault sets Default value.

func (*Responses) WithMapOfAnything

func (r *Responses) WithMapOfAnything(val map[string]interface{}) *Responses

WithMapOfAnything sets MapOfAnything value.

func (*Responses) WithMapOfAnythingItem

func (r *Responses) WithMapOfAnythingItem(key string, val interface{}) *Responses

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Responses) WithMapOfResponseOrReferenceValues

func (r *Responses) WithMapOfResponseOrReferenceValues(val map[string]ResponseOrReference) *Responses

WithMapOfResponseOrReferenceValues sets MapOfResponseOrReferenceValues value.

func (*Responses) WithMapOfResponseOrReferenceValuesItem

func (r *Responses) WithMapOfResponseOrReferenceValuesItem(key string, val ResponseOrReference) *Responses

WithMapOfResponseOrReferenceValuesItem sets MapOfResponseOrReferenceValues item value.

type SecurityScheme

type SecurityScheme struct {
	Description   *string                   `json:"description,omitempty"`
	APIKey        *SecuritySchemeAPIKey     `json:"-"`
	HTTP          *SecuritySchemeHTTP       `json:"-"`
	HTTPBearer    *SecuritySchemeHTTPBearer `json:"-"`
	Oauth2        *SecuritySchemeOauth2     `json:"-"`
	Oidc          *SecuritySchemeOidc       `json:"-"`
	MutualTLS     *MutualTLS                `json:"-"`
	MapOfAnything map[string]interface{}    `json:"-"` // Key must match pattern: `^x-`.
}

SecurityScheme structure is generated from "#/$defs/security-scheme".

func (*SecurityScheme) APIKeyEns

func (s *SecurityScheme) APIKeyEns() *SecuritySchemeAPIKey

APIKeyEns ensures returned APIKey is not nil.

func (*SecurityScheme) HTTPBearerEns

func (s *SecurityScheme) HTTPBearerEns() *SecuritySchemeHTTPBearer

HTTPBearerEns ensures returned HTTPBearer is not nil.

func (*SecurityScheme) HTTPEns

func (s *SecurityScheme) HTTPEns() *SecuritySchemeHTTP

HTTPEns ensures returned HTTP is not nil.

func (SecurityScheme) MarshalJSON

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

MarshalJSON encodes JSON.

func (*SecurityScheme) MutualTLSEns

func (s *SecurityScheme) MutualTLSEns() *MutualTLS

MutualTLSEns ensures returned MutualTLS is not nil.

func (*SecurityScheme) Oauth2Ens

func (s *SecurityScheme) Oauth2Ens() *SecuritySchemeOauth2

Oauth2Ens ensures returned Oauth2 is not nil.

func (*SecurityScheme) OidcEns

func (s *SecurityScheme) OidcEns() *SecuritySchemeOidc

OidcEns ensures returned Oidc is not nil.

func (*SecurityScheme) UnmarshalJSON

func (s *SecurityScheme) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecurityScheme) WithAPIKey

WithAPIKey sets APIKey value.

func (*SecurityScheme) WithDescription

func (s *SecurityScheme) WithDescription(val string) *SecurityScheme

WithDescription sets Description value.

func (*SecurityScheme) WithHTTP

WithHTTP sets HTTP value.

func (*SecurityScheme) WithHTTPBearer

func (s *SecurityScheme) WithHTTPBearer(val SecuritySchemeHTTPBearer) *SecurityScheme

WithHTTPBearer sets HTTPBearer value.

func (*SecurityScheme) WithMapOfAnything

func (s *SecurityScheme) WithMapOfAnything(val map[string]interface{}) *SecurityScheme

WithMapOfAnything sets MapOfAnything value.

func (*SecurityScheme) WithMapOfAnythingItem

func (s *SecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *SecurityScheme

WithMapOfAnythingItem sets MapOfAnything item value.

func (*SecurityScheme) WithMutualTLS

func (s *SecurityScheme) WithMutualTLS(val MutualTLS) *SecurityScheme

WithMutualTLS sets MutualTLS value.

func (*SecurityScheme) WithOauth2

WithOauth2 sets Oauth2 value.

func (*SecurityScheme) WithOidc

WithOidc sets Oidc value.

type SecuritySchemeAPIKey

type SecuritySchemeAPIKey struct {
	Name string                 `json:"name"` // Required.
	In   SecuritySchemeAPIKeyIn `json:"in"`   // Required.
}

SecuritySchemeAPIKey structure is generated from "#/$defs/security-scheme/$defs/type-apikey".

func (SecuritySchemeAPIKey) MarshalJSON

func (s SecuritySchemeAPIKey) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecuritySchemeAPIKey) UnmarshalJSON

func (s *SecuritySchemeAPIKey) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecuritySchemeAPIKey) WithIn

WithIn sets In value.

func (*SecuritySchemeAPIKey) WithName

WithName sets Name value.

type SecuritySchemeAPIKeyIn

type SecuritySchemeAPIKeyIn string

SecuritySchemeAPIKeyIn is an enum type.

func (SecuritySchemeAPIKeyIn) MarshalJSON

func (i SecuritySchemeAPIKeyIn) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecuritySchemeAPIKeyIn) UnmarshalJSON

func (i *SecuritySchemeAPIKeyIn) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type SecuritySchemeHTTP

type SecuritySchemeHTTP struct {
	Scheme string `json:"scheme"` // Required.
}

SecuritySchemeHTTP structure is generated from "#/$defs/security-scheme/$defs/type-http".

func (SecuritySchemeHTTP) MarshalJSON

func (s SecuritySchemeHTTP) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecuritySchemeHTTP) UnmarshalJSON

func (s *SecuritySchemeHTTP) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecuritySchemeHTTP) WithScheme

func (s *SecuritySchemeHTTP) WithScheme(val string) *SecuritySchemeHTTP

WithScheme sets Scheme value.

type SecuritySchemeHTTPBearer

type SecuritySchemeHTTPBearer struct {
	// Value must match pattern: `^[Bb][Ee][Aa][Rr][Ee][Rr]$`.
	// Required.
	Scheme       string  `json:"scheme"`
	BearerFormat *string `json:"bearerFormat,omitempty"`
}

SecuritySchemeHTTPBearer structure is generated from "#/$defs/security-scheme/$defs/type-http-bearer".

func (SecuritySchemeHTTPBearer) MarshalJSON

func (s SecuritySchemeHTTPBearer) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecuritySchemeHTTPBearer) UnmarshalJSON

func (s *SecuritySchemeHTTPBearer) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecuritySchemeHTTPBearer) WithBearerFormat

func (s *SecuritySchemeHTTPBearer) WithBearerFormat(val string) *SecuritySchemeHTTPBearer

WithBearerFormat sets BearerFormat value.

func (*SecuritySchemeHTTPBearer) WithScheme

WithScheme sets Scheme value.

type SecuritySchemeOauth2

type SecuritySchemeOauth2 struct {
	Flows OauthFlows `json:"flows"` // Required.
}

SecuritySchemeOauth2 structure is generated from "#/$defs/security-scheme/$defs/type-oauth2".

func (SecuritySchemeOauth2) MarshalJSON

func (s SecuritySchemeOauth2) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecuritySchemeOauth2) UnmarshalJSON

func (s *SecuritySchemeOauth2) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecuritySchemeOauth2) WithFlows

WithFlows sets Flows value.

type SecuritySchemeOidc

type SecuritySchemeOidc struct {
	// Format: uri.
	// Required.
	OpenIDConnectURL string `json:"openIdConnectUrl"`
}

SecuritySchemeOidc structure is generated from "#/$defs/security-scheme/$defs/type-oidc".

func (SecuritySchemeOidc) MarshalJSON

func (s SecuritySchemeOidc) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecuritySchemeOidc) UnmarshalJSON

func (s *SecuritySchemeOidc) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecuritySchemeOidc) WithOpenIDConnectURL

func (s *SecuritySchemeOidc) WithOpenIDConnectURL(val string) *SecuritySchemeOidc

WithOpenIDConnectURL sets OpenIDConnectURL value.

type SecuritySchemeOrReference

type SecuritySchemeOrReference struct {
	Reference      *Reference      `json:"-"`
	SecurityScheme *SecurityScheme `json:"-"`
}

SecuritySchemeOrReference structure is generated from "#/$defs/security-scheme-or-reference".

func (SecuritySchemeOrReference) MarshalJSON

func (s SecuritySchemeOrReference) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecuritySchemeOrReference) ReferenceEns

func (s *SecuritySchemeOrReference) ReferenceEns() *Reference

ReferenceEns ensures returned Reference is not nil.

func (*SecuritySchemeOrReference) SecuritySchemeEns

func (s *SecuritySchemeOrReference) SecuritySchemeEns() *SecurityScheme

SecuritySchemeEns ensures returned SecurityScheme is not nil.

func (*SecuritySchemeOrReference) UnmarshalJSON

func (s *SecuritySchemeOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecuritySchemeOrReference) WithReference

WithReference sets Reference value.

func (*SecuritySchemeOrReference) WithSecurityScheme

WithSecurityScheme sets SecurityScheme value.

type Server

type Server struct {
	// Format: uri-reference.
	// Required.
	URL           string                    `json:"url"`
	Description   *string                   `json:"description,omitempty"`
	Variables     map[string]ServerVariable `json:"variables,omitempty"`
	MapOfAnything map[string]interface{}    `json:"-"` // Key must match pattern: `^x-`.
}

Server structure is generated from "#/$defs/server".

func (Server) MarshalJSON

func (s Server) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Server) UnmarshalJSON

func (s *Server) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Server) WithDescription

func (s *Server) WithDescription(val string) *Server

WithDescription sets Description value.

func (*Server) WithMapOfAnything

func (s *Server) WithMapOfAnything(val map[string]interface{}) *Server

WithMapOfAnything sets MapOfAnything value.

func (*Server) WithMapOfAnythingItem

func (s *Server) WithMapOfAnythingItem(key string, val interface{}) *Server

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Server) WithURL

func (s *Server) WithURL(val string) *Server

WithURL sets URL value.

func (*Server) WithVariables

func (s *Server) WithVariables(val map[string]ServerVariable) *Server

WithVariables sets Variables value.

func (*Server) WithVariablesItem

func (s *Server) WithVariablesItem(key string, val ServerVariable) *Server

WithVariablesItem sets Variables item value.

type ServerVariable

type ServerVariable struct {
	Enum          []string               `json:"enum,omitempty"`
	Default       string                 `json:"default"` // Required.
	Description   *string                `json:"description,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

ServerVariable structure is generated from "#/$defs/server-variable".

func (ServerVariable) MarshalJSON

func (s ServerVariable) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ServerVariable) UnmarshalJSON

func (s *ServerVariable) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ServerVariable) WithDefault

func (s *ServerVariable) WithDefault(val string) *ServerVariable

WithDefault sets Default value.

func (*ServerVariable) WithDescription

func (s *ServerVariable) WithDescription(val string) *ServerVariable

WithDescription sets Description value.

func (*ServerVariable) WithEnum

func (s *ServerVariable) WithEnum(val ...string) *ServerVariable

WithEnum sets Enum value.

func (*ServerVariable) WithMapOfAnything

func (s *ServerVariable) WithMapOfAnything(val map[string]interface{}) *ServerVariable

WithMapOfAnything sets MapOfAnything value.

func (*ServerVariable) WithMapOfAnythingItem

func (s *ServerVariable) WithMapOfAnythingItem(key string, val interface{}) *ServerVariable

WithMapOfAnythingItem sets MapOfAnything item value.

type Spec

type Spec struct {
	// Value must match pattern: `^3\.1\.\d+(-.+)?$`.
	// Required.
	Openapi           string                         `json:"openapi"`
	Info              Info                           `json:"info"`                        // Required.
	JSONSchemaDialect *string                        `json:"jsonSchemaDialect,omitempty"` // Format: uri.
	Servers           []Server                       `json:"servers,omitempty"`
	Paths             *Paths                         `json:"paths,omitempty"`
	Webhooks          map[string]PathItemOrReference `json:"webhooks,omitempty"`
	Components        *Components                    `json:"components,omitempty"`
	Security          []map[string][]string          `json:"security,omitempty"`
	Tags              []Tag                          `json:"tags,omitempty"`
	ExternalDocs      *ExternalDocumentation         `json:"externalDocs,omitempty"`
	MapOfAnything     map[string]interface{}         `json:"-"` // Key must match pattern: `^x-`.
}

Spec structure is generated from "#".

The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0.

func (*Spec) AddOperation

func (s *Spec) AddOperation(method, path string, operation Operation) error

AddOperation validates and sets operation by path and method.

It will fail if operation with method and path already exists.

func (*Spec) ComponentsEns

func (s *Spec) ComponentsEns() *Components

ComponentsEns ensures returned Components is not nil.

func (*Spec) Description

func (s *Spec) Description() string

Description returns service description.

func (*Spec) ExternalDocsEns

func (s *Spec) ExternalDocsEns() *ExternalDocumentation

ExternalDocsEns ensures returned ExternalDocs is not nil.

func (Spec) MarshalJSON

func (s Spec) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Spec) MarshalYAML

func (s *Spec) MarshalYAML() ([]byte, error)

MarshalYAML produces YAML bytes.

func (*Spec) PathsEns

func (s *Spec) PathsEns() *Paths

PathsEns ensures returned Paths is not nil.

func (*Spec) SetAPIKeySecurity

func (s *Spec) SetAPIKeySecurity(securityName string, fieldName string, fieldIn openapi.In, description string)

SetAPIKeySecurity sets security definition.

Example
reflector := openapi31.Reflector{}
securityName := "api_key"

// Declare security scheme.
reflector.SpecEns().SetAPIKeySecurity(securityName, "Authorization",
	openapi.InHeader, "API Access")

oc, _ := reflector.NewOperationContext(http.MethodGet, "/secure")
oc.AddRespStructure(struct {
	Secret string `json:"secret"`
}{})

// Add security requirement to operation.
oc.AddSecurity(securityName)

// Describe unauthorized response.
oc.AddRespStructure(struct {
	Error string `json:"error"`
}{}, func(cu *openapi.ContentUnit) {
	cu.HTTPStatus = http.StatusUnauthorized
})

// Add operation to schema.
_ = reflector.AddOperation(oc)

schema, err := reflector.Spec.MarshalYAML()
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(schema))
Output:

openapi: 3.1.0
info:
  title: ""
  version: ""
paths:
  /secure:
    get:
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  secret:
                    type: string
                type: object
          description: OK
        "401":
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                type: object
          description: Unauthorized
      security:
      - api_key: []
components:
  securitySchemes:
    api_key:
      description: API Access
      in: header
      name: Authorization
      type: apiKey

func (*Spec) SetDescription

func (s *Spec) SetDescription(d string)

SetDescription describes the service.

func (*Spec) SetHTTPBasicSecurity

func (s *Spec) SetHTTPBasicSecurity(securityName string, description string)

SetHTTPBasicSecurity sets security definition.

Example
reflector := openapi31.Reflector{}
securityName := "admin"

// Declare security scheme.
reflector.SpecEns().SetHTTPBasicSecurity(securityName, "Admin Access")

oc, _ := reflector.NewOperationContext(http.MethodGet, "/secure")
oc.AddRespStructure(struct {
	Secret string `json:"secret"`
}{})

// Add security requirement to operation.
oc.AddSecurity(securityName)

// Describe unauthorized response.
oc.AddRespStructure(struct {
	Error string `json:"error"`
}{}, func(cu *openapi.ContentUnit) {
	cu.HTTPStatus = http.StatusUnauthorized
})

// Add operation to schema.
_ = reflector.AddOperation(oc)

schema, err := reflector.Spec.MarshalYAML()
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(schema))
Output:

openapi: 3.1.0
info:
  title: ""
  version: ""
paths:
  /secure:
    get:
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  secret:
                    type: string
                type: object
          description: OK
        "401":
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                type: object
          description: Unauthorized
      security:
      - admin: []
components:
  securitySchemes:
    admin:
      description: Admin Access
      scheme: basic
      type: http

func (*Spec) SetHTTPBearerTokenSecurity

func (s *Spec) SetHTTPBearerTokenSecurity(securityName string, format string, description string)

SetHTTPBearerTokenSecurity sets security definition.

Example
reflector := openapi31.Reflector{}
securityName := "bearer_token"

// Declare security scheme.
reflector.SpecEns().SetHTTPBearerTokenSecurity(securityName, "JWT", "Admin Access")

oc, _ := reflector.NewOperationContext(http.MethodGet, "/secure")
oc.AddRespStructure(struct {
	Secret string `json:"secret"`
}{})

// Add security requirement to operation.
oc.AddSecurity(securityName)

// Describe unauthorized response.
oc.AddRespStructure(struct {
	Error string `json:"error"`
}{}, func(cu *openapi.ContentUnit) {
	cu.HTTPStatus = http.StatusUnauthorized
})

// Add operation to schema.
_ = reflector.AddOperation(oc)

schema, err := reflector.Spec.MarshalYAML()
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(schema))
Output:

openapi: 3.1.0
info:
  title: ""
  version: ""
paths:
  /secure:
    get:
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  secret:
                    type: string
                type: object
          description: OK
        "401":
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                type: object
          description: Unauthorized
      security:
      - bearer_token: []
components:
  securitySchemes:
    bearer_token:
      bearerFormat: JWT
      description: Admin Access
      scheme: bearer
      type: http

func (*Spec) SetTitle

func (s *Spec) SetTitle(t string)

SetTitle describes the service.

func (*Spec) SetVersion

func (s *Spec) SetVersion(v string)

SetVersion describes the service.

func (*Spec) SetupOperation

func (s *Spec) SetupOperation(method, path string, setup ...func(*Operation) error) error

SetupOperation creates operation if it is not present and applies setup functions.

func (*Spec) Title

func (s *Spec) Title() string

Title returns service title.

func (*Spec) UnmarshalJSON

func (s *Spec) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Spec) UnmarshalYAML

func (s *Spec) UnmarshalYAML(data []byte) error

UnmarshalYAML reads from YAML bytes.

func (*Spec) Version

func (s *Spec) Version() string

Version returns service version.

func (*Spec) WithComponents

func (s *Spec) WithComponents(val Components) *Spec

WithComponents sets Components value.

func (*Spec) WithExternalDocs

func (s *Spec) WithExternalDocs(val ExternalDocumentation) *Spec

WithExternalDocs sets ExternalDocs value.

func (*Spec) WithInfo

func (s *Spec) WithInfo(val Info) *Spec

WithInfo sets Info value.

func (*Spec) WithJSONSchemaDialect

func (s *Spec) WithJSONSchemaDialect(val string) *Spec

WithJSONSchemaDialect sets JSONSchemaDialect value.

func (*Spec) WithMapOfAnything

func (s *Spec) WithMapOfAnything(val map[string]interface{}) *Spec

WithMapOfAnything sets MapOfAnything value.

func (*Spec) WithMapOfAnythingItem

func (s *Spec) WithMapOfAnythingItem(key string, val interface{}) *Spec

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Spec) WithOpenapi

func (s *Spec) WithOpenapi(val string) *Spec

WithOpenapi sets Openapi value.

func (*Spec) WithPaths

func (s *Spec) WithPaths(val Paths) *Spec

WithPaths sets Paths value.

func (*Spec) WithSecurity

func (s *Spec) WithSecurity(val ...map[string][]string) *Spec

WithSecurity sets Security value.

func (*Spec) WithServers

func (s *Spec) WithServers(val ...Server) *Spec

WithServers sets Servers value.

func (*Spec) WithTags

func (s *Spec) WithTags(val ...Tag) *Spec

WithTags sets Tags value.

func (*Spec) WithWebhooks

func (s *Spec) WithWebhooks(val map[string]PathItemOrReference) *Spec

WithWebhooks sets Webhooks value.

func (*Spec) WithWebhooksItem

func (s *Spec) WithWebhooksItem(key string, val PathItemOrReference) *Spec

WithWebhooksItem sets Webhooks item value.

type Tag

type Tag struct {
	Name          string                 `json:"name"` // Required.
	Description   *string                `json:"description,omitempty"`
	ExternalDocs  *ExternalDocumentation `json:"externalDocs,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

Tag structure is generated from "#/$defs/tag".

func (*Tag) ExternalDocsEns

func (t *Tag) ExternalDocsEns() *ExternalDocumentation

ExternalDocsEns ensures returned ExternalDocs is not nil.

func (Tag) MarshalJSON

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

MarshalJSON encodes JSON.

func (*Tag) UnmarshalJSON

func (t *Tag) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Tag) WithDescription

func (t *Tag) WithDescription(val string) *Tag

WithDescription sets Description value.

func (*Tag) WithExternalDocs

func (t *Tag) WithExternalDocs(val ExternalDocumentation) *Tag

WithExternalDocs sets ExternalDocs value.

func (*Tag) WithMapOfAnything

func (t *Tag) WithMapOfAnything(val map[string]interface{}) *Tag

WithMapOfAnything sets MapOfAnything value.

func (*Tag) WithMapOfAnythingItem

func (t *Tag) WithMapOfAnythingItem(key string, val interface{}) *Tag

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Tag) WithName

func (t *Tag) WithName(val string) *Tag

WithName sets Name value.

Jump to

Keyboard shortcuts

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