Documentation ¶
Index ¶
- type Callback
- type Components
- func (c *Components) AddJSONResponse(name string, desc string, s *Ref[Schema])
- func (c *Components) AddRequestBody(name string, r *RequestBody)
- func (c *Components) AddResponse(name string, r *Response)
- func (c *Components) AddSchema(name string, s *Schema)
- func (c *Components) AddSecurityScheme(name string, s *SecurityScheme)
- func (c *Components) GetRequestBody(name string) *RequestBody
- func (c *Components) GetResponse(name string) *Response
- func (c *Components) GetSchema(name string) *Schema
- func (c *Components) GetSecurityScheme(name string) *SecurityScheme
- type Contact
- type Discriminator
- type Encoding
- type Example
- type ExternalDocs
- type Header
- type Info
- type License
- type Link
- type MediaTypeObject
- type OAuthFlow
- type OAuthFlows
- type Operation
- func (o *Operation) AddParameter(param *Parameter)
- func (o *Operation) AddRequestBody(rb *RequestBody)
- func (o *Operation) AddRequestBodyRef(ref string)
- func (o *Operation) AddResponse(code string, resp *Response)
- func (o *Operation) AddResponseRef(code string, ref string)
- func (o *Operation) AddSecurityRequirement(s *SecurityRequirement)
- func (o *Operation) AddSummary(summary string)
- func (o *Operation) AddTags(tags ...string)
- type Parameter
- type ParameterLocation
- type PathItem
- type Paths
- type Ref
- type RequestBody
- type Response
- type Responses
- type Schema
- type SchemaFormat
- type SchemaType
- type SecurityRequirement
- type SecurityScheme
- type SecuritySchemeType
- type Server
- type ServerVariable
- type Specification
- func (d *Specification) AddSecurityRequirement(r *SecurityRequirement)
- func (d *Specification) AddServer(s *Server)
- func (d *Specification) AddTag(tag *Tag)
- func (d *Specification) Copy() *Specification
- func (d *Specification) GetComponents() *Components
- func (d *Specification) GetTagByName(name string) *Tag
- type TODO
- type Tag
- type XML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Components ¶
type Components struct { Schemas map[string]*Schema `json:"schemas,omitempty" yaml:"schemas,omitempty"` Responses map[string]*Response `json:"responses,omitempty" yaml:"responses,omitempty"` Parameters map[string]*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"` Examples map[string]*Example `json:"examples,omitempty" yaml:"examples,omitempty"` RequestBodies map[string]*RequestBody `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"` Headers map[string]*Header `json:"headers,omitempty" yaml:"headers,omitempty"` SecuritySchemes map[string]*SecurityScheme `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"` Links map[string]*Link `json:"links,omitempty" yaml:"links,omitempty"` Callbacks map[string]*Callback `json:"callbacks,omitempty" yaml:"callbacks,omitempty"` PathItems map[string]*PathItem `json:"pathItems,omitempty" yaml:"pathItems,omitempty"` }
4.8.7 https://spec.openapis.org/oas/v3.1.0#components-object
func (*Components) AddJSONResponse ¶
func (c *Components) AddJSONResponse(name string, desc string, s *Ref[Schema])
func (*Components) AddRequestBody ¶
func (c *Components) AddRequestBody(name string, r *RequestBody)
func (*Components) AddResponse ¶
func (c *Components) AddResponse(name string, r *Response)
func (*Components) AddSchema ¶
func (c *Components) AddSchema(name string, s *Schema)
func (*Components) AddSecurityScheme ¶
func (c *Components) AddSecurityScheme(name string, s *SecurityScheme)
func (*Components) GetRequestBody ¶
func (c *Components) GetRequestBody(name string) *RequestBody
func (*Components) GetResponse ¶
func (c *Components) GetResponse(name string) *Response
func (*Components) GetSchema ¶
func (c *Components) GetSchema(name string) *Schema
func (*Components) GetSecurityScheme ¶
func (c *Components) GetSecurityScheme(name string) *SecurityScheme
type Contact ¶
type Discriminator ¶
type Discriminator struct {
TODO
}
4.8.25 https://spec.openapis.org/oas/v3.1.0#discriminator-object
type Encoding ¶
type Encoding struct { ContentType string `json:"content_type,omitempty" yaml:"content_type,omitempty"` Headers map[string]*Ref[Header] `json:"headers,omitempty" yaml:"headers,omitempty"` Style string `json:"style,omitempty" yaml:"style,omitempty"` Explode bool `json:"explode,omitempty" yaml:"explode,omitempty"` AllowReserved bool `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"` }
type Example ¶
type Example struct { Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Value interface{} `json:"value,omitempty" yaml:"value,omitempty"` ExternalValue string `json:"externalValue,omitempty" yaml:"externalValue,omitempty"` }
type ExternalDocs ¶
type ExternalDocs struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` URL string `json:"url" yaml:"url"` }
4.8.11 https://spec.openapis.org/oas/v3.1.0#external-documentation-object
type Info ¶
type Info struct { Title string `json:"title" yaml:"title"` Version string `json:"version" yaml:"version"` Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` TermsOfService string `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"` Contact *Contact `json:"contact,omitempty" yaml:"contact,omitempty"` License *License `json:"license,omitempty" yaml:"license,omitempty"` }
type License ¶
type MediaTypeObject ¶
type MediaTypeObject struct { Schema *Ref[Schema] `json:"schema,omitempty" yaml:"schema,omitempty"` Example interface{} `json:"example,omitempty" yaml:"example,omitempty"` Examples map[string]*Ref[Example] `json:"examples,omitempty" yaml:"examples,omitempty"` Encoding map[string]*Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"` }
4.8.14 https://spec.openapis.org/oas/v3.1.0#media-type-object
type OAuthFlow ¶
type OAuthFlow struct { AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"` RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"` Scopes map[string]string `json:"scopes,omitempty" yaml:"scopes,omitempty"` }
4.8.29 https://spec.openapis.org/oas/v3.1.0#oauth-flow-object
type OAuthFlows ¶
type OAuthFlows struct { Implicit *OAuthFlow `json:"implicit,omitempty" yaml:"implicit,omitempty"` Password *OAuthFlow `json:"password,omitempty" yaml:"password,omitempty"` ClientCredentials *OAuthFlow `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"` AuthorizationCode *OAuthFlow `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty"` }
4.8.28 https://spec.openapis.org/oas/v3.1.0#oauth-flows-object
type Operation ¶
type Operation struct { OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` Parameters []*Ref[Parameter] `json:"parameters,omitempty" yaml:"parameters,omitempty"` RequestBody *Ref[RequestBody] `json:"requestBody,omitempty" yaml:"requestBody,omitempty"` Responses map[string]*Ref[Response] `json:"responses,omitempty" yaml:"responses,omitempty"` Callbacks map[string]*Ref[Callback] `json:"callbacks,omitempty" yaml:"callbacks,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` Security []*SecurityRequirement `json:"security,omitempty" yaml:"security,omitempty"` Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` }
4.8.10 https://spec.openapis.org/oas/v3.1.0#operation-object
func (*Operation) AddParameter ¶
func (*Operation) AddRequestBody ¶
func (o *Operation) AddRequestBody(rb *RequestBody)
func (*Operation) AddRequestBodyRef ¶
func (*Operation) AddResponse ¶
func (*Operation) AddResponseRef ¶
func (*Operation) AddSecurityRequirement ¶
func (o *Operation) AddSecurityRequirement(s *SecurityRequirement)
func (*Operation) AddSummary ¶
type Parameter ¶
type Parameter struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` In ParameterLocation `json:"in,omitempty" yaml:"in,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"` Style string `json:"style,omitempty" yaml:"style,omitempty"` Explode bool `json:"explode,omitempty" yaml:"explode,omitempty"` AllowReserved bool `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"` Schema *Schema `json:"schema,omitempty" yaml:"schema,omitempty"` Examples []*Example `json:"examples,omitempty" yaml:"examples,omitempty"` Content map[string]*MediaTypeObject `json:"content,omitempty" yaml:"content,omitempty"` }
4.8.12 https://spec.openapis.org/oas/v3.1.0#parameter-object
type ParameterLocation ¶
type ParameterLocation string
const ( PathParameter ParameterLocation = "path" QueryParameter ParameterLocation = "query" HeaderParameter ParameterLocation = "header" CookieParameter ParameterLocation = "cookie" )
type PathItem ¶
type PathItem struct { Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Get *Operation `json:"get,omitempty" yaml:"get,omitempty"` Put *Operation `json:"put,omitempty" yaml:"put,omitempty"` Post *Operation `json:"post,omitempty" yaml:"post,omitempty"` Delete *Operation `json:"delete,omitempty" yaml:"delete,omitempty"` Options *Operation `json:"options,omitempty" yaml:"options,omitempty"` Head *Operation `json:"head,omitempty" yaml:"head,omitempty"` Patch *Operation `json:"patch,omitempty" yaml:"patch,omitempty"` Trace *Operation `json:"trace,omitempty" yaml:"trace,omitempty"` Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` Parameters *Ref[Parameter] `json:"parameters,omitempty" yaml:"parameters,omitempty"` }
type Ref ¶
4.8.23 https://spec.openapis.org/oas/v3.1.0#reference-object
func NewSchemaRef ¶
func NewSchemaValue ¶
func (*Ref[T]) DeRef ¶
func (r *Ref[T]) DeRef(c *Components) interface{}
func (*Ref[T]) MarshalJSON ¶
func (*Ref[T]) MarshalYAML ¶
type RequestBody ¶
type RequestBody struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` Content map[string]*MediaTypeObject `json:"content" yaml:"content"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` }
4.8.13 https://spec.openapis.org/oas/v3.1.0#request-body-object
type Response ¶
type Response struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` Headers map[string]*Ref[Header] `json:"headers,omitempty" yaml:"headers,omitempty"` Content map[string]*MediaTypeObject `json:"content,omitempty" yaml:"content,omitempty"` Links map[string]*Ref[Link] `json:"links,omitempty" yaml:"links,omitempty"` }
type Schema ¶
type Schema struct { Title string `json:"title,omitempty" yaml:"title,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Default interface{} `json:"default,omitempty" yaml:"default,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` ReadOnly bool `json:"read_only,omitempty" yaml:"read_only,omitempty"` WriteOnly bool `json:"write_only,omitempty" yaml:"write_only,omitempty"` Examples []interface{} `json:"examples,omitempty" yaml:"examples,omitempty"` AllOf []*Ref[Schema] `json:"allOf,omitempty" yaml:"allOf,omitempty"` XML *XML `json:"xml,omitempty" yaml:"xml,omitempty"` SourceType reflect.Type `json:"-" yaml:"-"` Type SchemaType `json:"type,omitempty" yaml:"type,omitempty"` Format SchemaFormat `json:"format,omitempty" yaml:"format,omitempty"` Enum []string `json:"enum,omitempty" yaml:"enum,omitempty"` Const interface{} `json:"const,omitempty" yaml:"const,omitempty"` Items *Ref[Schema] `json:"items,omitempty" yaml:"items,omitempty"` // Numeric MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"` Maximum *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"` ExclusiveMaximum *float64 `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` Minimum *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"` ExclusiveMinimum *float64 `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` // String MaxLength *int `json:"maxLength,omitempty" yaml:"maxLength,omitempty"` MinLength *int `json:"minLength,omitempty" yaml:"minLength,omitempty"` Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"` // Arrays MaxItems *int `json:"maxItems,omitempty" yaml:"maxItems,omitempty"` MinItems *int `json:"minItems,omitempty" yaml:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"` MaxContains *int `json:"maxContains,omitempty" yaml:"maxContains,omitempty"` MinContains *int `json:"minContains,omitempty" yaml:"minContains,omitempty"` // Objects Required []string `json:"required,omitempty" yaml:"required,omitempty"` Properties map[string]*Ref[Schema] `json:"properties,omitempty" yaml:"properties,omitempty"` MaxProperties *int `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"` MinProperties *int `json:"minProperties,omitempty" yaml:"minProperties,omitempty"` DependentRequired interface{} `json:"dependentRequired,omitempty" yaml:"dependentRequired,omitempty"` AdditionalProperties *Ref[Schema] `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"` }
4.8.24 https://spec.openapis.org/oas/v3.1.0#schema-object
func (*Schema) FromString ¶
type SchemaFormat ¶
type SchemaFormat string
const ( DateTimeSchemaFormat SchemaFormat = "date-time" DateSchemaFormat SchemaFormat = "date" TimeSchemaFormat SchemaFormat = "time" DurationSchemaFormat SchemaFormat = "duration" )
type SchemaType ¶
type SchemaType string
const ( NullSchemaType SchemaType = "null" BooleanSchemaType SchemaType = "boolean" ObjectSchemaType SchemaType = "object" ArraySchemaType SchemaType = "array" NumberSchemaType SchemaType = "number" StringSchemaType SchemaType = "string" IntegerSchemaType SchemaType = "integer" )
type SecurityScheme ¶
type SecurityScheme struct { Type SecuritySchemeType `json:"type,omitempty" yaml:"type,omitempty"` In string `json:"in,omitempty" yaml:"in,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` BearerFormat string `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"` Flows *OAuthFlows `json:"flows,omitempty" yaml:"flows,omitempty"` OpenIDConnectURL string `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"` }
4.8.27 https://spec.openapis.org/oas/v3.1.0#security-scheme-object
type SecuritySchemeType ¶
type SecuritySchemeType string
const ( APIKeySecuritySchemeType SecuritySchemeType = "apiKey" HTTPSecuritySchemeType SecuritySchemeType = "http" MutualTLSSecuritySchemeType SecuritySchemeType = "mutualTLS" OAuth2SecuritySchemeType SecuritySchemeType = "oauth2" OpenIDConnectSecuritySchemeType SecuritySchemeType = "openIdConnect" )
type Server ¶
type Server struct { URL string `json:"url" yaml:"url"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Variables map[string]*ServerVariable `json:"variables,omitempty" yaml:"variables,omitempty"` }
type ServerVariable ¶
type ServerVariable struct { Enum []string `json:"enum" yaml:"enum"` Default string `json:"default" yaml:"default"` Description string `json:"description,omitempty" yaml:"description,omitempty"` }
4.8.6 https://spec.openapis.org/oas/v3.1.0#server-variable-object
type Specification ¶
type Specification struct { OpenAPI string `json:"openapi" yaml:"openapi"` JSONSchemaDialect string `json:"jsonSchemaDialect,omitempty" yaml:"jsonSchemaDialect,omitempty"` Info Info `json:"info" yaml:"info"` Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` Tags []*Tag `json:"tags,omitempty" yaml:"tags,omitempty"` Paths Paths `json:"paths,omitempty" yaml:"paths,omitempty"` Webhooks map[string]*Ref[PathItem] `json:"webhooks,omitempty" yaml:"webhooks,omitempty"` Components *Components `json:"components,omitempty" yaml:"components,omitempty"` Security []*SecurityRequirement `json:"security,omitempty" yaml:"security,omitempty"` }
https://spec.openapis.org/oas/v3.1.0#openapi-object
func NewSpecification ¶
func NewSpecification() *Specification
func (*Specification) AddSecurityRequirement ¶
func (d *Specification) AddSecurityRequirement(r *SecurityRequirement)
func (*Specification) AddServer ¶
func (d *Specification) AddServer(s *Server)
func (*Specification) AddTag ¶
func (d *Specification) AddTag(tag *Tag)
func (*Specification) Copy ¶
func (d *Specification) Copy() *Specification
func (*Specification) GetComponents ¶
func (d *Specification) GetComponents() *Components
func (*Specification) GetTagByName ¶
func (d *Specification) GetTagByName(name string) *Tag
type Tag ¶
type Tag struct { Name string `json:"name" yaml:"name"` Description string `json:"description,omitempty" yaml:"description,omitempty"` ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` }
type XML ¶
type XML struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"` Attribute bool `json:"attribute,omitempty" yaml:"attribute,omitempty"` Wrapped bool `json:"wrapped,omitempty" yaml:"wrapped,omitempty"` }