Documentation ¶
Overview ¶
Package openapi GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
Index ¶
- func InjectContext(ctx context.Context, o *OpenAPI) context.Context
- type CallbacksObject
- type ComponentsObject
- type Contact
- type ContentObject
- type EncodingObject
- type HeaderObject
- type HeadersObject
- type InfoObject
- type License
- type MediaTypeObject
- type OpenAPI
- type OperationObject
- func (o *OperationObject) AddParameter(name string, in ParameterIn, p *Parameter)
- func (v OperationObject) RuntimeDoc(names ...string) ([]string, bool)
- func (o *OperationObject) SetRequestBody(rb *RequestBodyObject)
- func (o OperationObject) WithDesc(desc string) *OperationObject
- func (o OperationObject) WithSummary(summary string) *OperationObject
- func (o OperationObject) WithTags(tags ...string) *OperationObject
- type Parameter
- type ParameterIn
- type ParameterObject
- type ParameterStyle
- type PathItemObject
- type Payload
- type RequestBodyObject
- type ResponseObject
- type ResponsesObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbacksObject ¶
type CallbacksObject struct {
Callbacks map[string]*PathItemObject `json:"callbacks,omitzero"`
}
func (*CallbacksObject) AddCallback ¶
func (o *CallbacksObject) AddCallback(name string, c *PathItemObject)
func (CallbacksObject) RuntimeDoc ¶
func (v CallbacksObject) RuntimeDoc(names ...string) ([]string, bool)
type ComponentsObject ¶
type ComponentsObject struct {
Schemas map[string]jsonschema.Schema `json:"schemas,omitzero"`
}
https://spec.openapis.org/oas/latest.html#components-object FIXME now only support schemas
func (*ComponentsObject) AddSchema ¶
func (o *ComponentsObject) AddSchema(id string, s jsonschema.Schema)
func (*ComponentsObject) RefSchema ¶
func (o *ComponentsObject) RefSchema(id string) jsonschema.Schema
func (ComponentsObject) RuntimeDoc ¶
func (v ComponentsObject) RuntimeDoc(names ...string) ([]string, bool)
type Contact ¶
type ContentObject ¶
type ContentObject struct {
Content map[string]*MediaTypeObject `json:"content,omitzero"`
}
func (*ContentObject) AddContent ¶
func (o *ContentObject) AddContent(contentType string, mt *MediaTypeObject)
func (ContentObject) RuntimeDoc ¶
func (v ContentObject) RuntimeDoc(names ...string) ([]string, bool)
type EncodingObject ¶
type EncodingObject struct { ContentType string `json:"contentType"` HeadersObject Style ParameterStyle `json:"style,omitzero"` Explode bool `json:"explode,omitzero"` AllowReserved bool `json:"allowReserved,omitzero"` jsonschema.Ext }
func (EncodingObject) RuntimeDoc ¶
func (v EncodingObject) RuntimeDoc(names ...string) ([]string, bool)
type HeaderObject ¶
type HeaderObject = Parameter
type HeadersObject ¶
type HeadersObject struct {
Headers map[string]*HeaderObject `json:"headers,omitzero"`
}
func (*HeadersObject) AddHeader ¶
func (object *HeadersObject) AddHeader(name string, h *Parameter)
func (HeadersObject) RuntimeDoc ¶
func (v HeadersObject) RuntimeDoc(names ...string) ([]string, bool)
type InfoObject ¶
type InfoObject struct { Title string `json:"title"` Description string `json:"description,omitzero"` TermsOfService string `json:"termsOfService,omitzero"` Contact *Contact `json:"contact,omitzero"` License *License `json:"license,omitzero"` Version string `json:"version,omitzero"` }
https://spec.openapis.org/oas/latest.html#infoObject
func (InfoObject) RuntimeDoc ¶
func (v InfoObject) RuntimeDoc(names ...string) ([]string, bool)
type MediaTypeObject ¶
type MediaTypeObject struct { Schema jsonschema.Schema `json:"schema,omitzero"` Encoding map[string]*EncodingObject `json:"encoding,omitzero"` jsonschema.Ext }
func (*MediaTypeObject) AddEncoding ¶
func (o *MediaTypeObject) AddEncoding(name string, e *EncodingObject)
func (MediaTypeObject) RuntimeDoc ¶
func (v MediaTypeObject) RuntimeDoc(names ...string) ([]string, bool)
type OpenAPI ¶
type OpenAPI struct { OpenAPI string `json:"openapi"` InfoObject `json:"info"` ComponentsObject `json:"components"` Paths map[string]*PathItemObject `json:"paths"` jsonschema.Ext }
func FromContext ¶
func NewOpenAPI ¶
func NewOpenAPI() *OpenAPI
func (*OpenAPI) AddOperation ¶
func (p *OpenAPI) AddOperation(method string, path string, op *OperationObject)
type OperationObject ¶
type OperationObject struct { Tags []string `json:"tags,omitzero"` Summary string `json:"summary,omitzero"` Description string `json:"description,omitzero"` OperationId string `json:"operationId"` Parameters []*ParameterObject `json:"parameters,omitzero"` RequestBody *RequestBodyObject `json:"requestBody,omitzero"` ResponsesObject CallbacksObject Deprecated *bool `json:"deprecated,omitzero"` jsonschema.Ext }
func NewOperation ¶
func NewOperation(operationId string) *OperationObject
func (*OperationObject) AddParameter ¶
func (o *OperationObject) AddParameter(name string, in ParameterIn, p *Parameter)
func (OperationObject) RuntimeDoc ¶
func (v OperationObject) RuntimeDoc(names ...string) ([]string, bool)
func (*OperationObject) SetRequestBody ¶
func (o *OperationObject) SetRequestBody(rb *RequestBodyObject)
func (OperationObject) WithDesc ¶
func (o OperationObject) WithDesc(desc string) *OperationObject
func (OperationObject) WithSummary ¶
func (o OperationObject) WithSummary(summary string) *OperationObject
func (OperationObject) WithTags ¶
func (o OperationObject) WithTags(tags ...string) *OperationObject
type Parameter ¶
type Parameter struct { Schema jsonschema.Schema `json:"schema"` Description string `json:"description,omitzero"` Required *bool `json:"required,omitzero"` Deprecated *bool `json:"deprecated,omitzero"` // https://spec.openapis.org/oas/latest.html#parameter-object Style ParameterStyle `json:"style,omitzero"` Explode *bool `json:"explode,omitzero"` jsonschema.Ext }
type ParameterIn ¶
type ParameterIn string
const ( InQuery ParameterIn = "query" InPath ParameterIn = "path" InHeader ParameterIn = "header" InCookie ParameterIn = "cookie" )
func (ParameterIn) RuntimeDoc ¶
func (ParameterIn) RuntimeDoc(names ...string) ([]string, bool)
type ParameterObject ¶
type ParameterObject struct { Name string `json:"name"` In ParameterIn `json:"in"` Parameter }
https://spec.openapis.org/oas/latest.html#parameter-object
func NewParameter ¶
func NewParameter(name string, in ParameterIn) *ParameterObject
func (ParameterObject) RuntimeDoc ¶
func (v ParameterObject) RuntimeDoc(names ...string) ([]string, bool)
func (*ParameterObject) SetDefaultStyle ¶
func (o *ParameterObject) SetDefaultStyle()
type ParameterStyle ¶
type ParameterStyle string
const ( // https://tools.ietf.org/html/rfc6570#section-3.2.7 ParameterStyleMatrix ParameterStyle = "matrix" // https://tools.ietf.org/html/rfc6570#section-3.2.5 ParameterStyleLabel ParameterStyle = "label" // https://tools.ietf.org/html/rfc6570#section-3.2.8 ParameterStyleForm ParameterStyle = "form" // for array, csv https://tools.ietf.org/html/rfc6570#section-3.2.2 ParameterStyleSimple ParameterStyle = "simple" // for array, ssv ParameterStyleSpaceDelimited ParameterStyle = "spaceDelimited" // for array, pipes ParameterStylePipeDelimited ParameterStyle = "pipeDelimited" // for object ParameterStyleDeepObject ParameterStyle = "deepObject" )
func (ParameterStyle) RuntimeDoc ¶
func (ParameterStyle) RuntimeDoc(names ...string) ([]string, bool)
type PathItemObject ¶
type PathItemObject struct { Summary string `json:"summary,omitzero"` Description string `json:"description,omitzero"` Operations map[string]*OperationObject `json:",inline"` }
https://spec.openapis.org/oas/latest.html#pathItemObject no need $ref, server, parameters
func (PathItemObject) RuntimeDoc ¶
func (v PathItemObject) RuntimeDoc(names ...string) ([]string, bool)
type Payload ¶
type Payload struct {
OpenAPI
}
func (Payload) MarshalJSON ¶
func (*Payload) UnmarshalJSON ¶
type RequestBodyObject ¶
type RequestBodyObject struct { Description string `json:"description,omitzero"` Required bool `json:"required,omitzero"` ContentObject jsonschema.Ext }
func (RequestBodyObject) RuntimeDoc ¶
func (v RequestBodyObject) RuntimeDoc(names ...string) ([]string, bool)
type ResponseObject ¶
type ResponseObject struct { Description string `json:"description"` HeadersObject ContentObject jsonschema.Ext }
func (ResponseObject) RuntimeDoc ¶
func (v ResponseObject) RuntimeDoc(names ...string) ([]string, bool)
type ResponsesObject ¶
type ResponsesObject struct {
Responses map[string]*ResponseObject `json:"responses"`
}
func (*ResponsesObject) AddResponse ¶
func (o *ResponsesObject) AddResponse(statusCode int, r *ResponseObject)
func (ResponsesObject) RuntimeDoc ¶
func (v ResponsesObject) RuntimeDoc(names ...string) ([]string, bool)
func (*ResponsesObject) SetDefaultResponse ¶
func (o *ResponsesObject) SetDefaultResponse(r *ResponseObject)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package jsonschema GENERATED BY gengo:deepcopy DON'T EDIT THIS FILE
|
Package jsonschema GENERATED BY gengo:deepcopy DON'T EDIT THIS FILE |
extractors
Package extractors GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
|
Package extractors GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE |
Click to show internal directories.
Click to hide internal directories.