Documentation
¶
Index ¶
- Constants
- func GetSecurity(secSchemes openapi3.SecuritySchemes, ...) ([][]Security, error)
- type Components
- type ComponentsSchemas
- type Contact
- type CookieParameter
- type HTTPMethod
- type HTTPMethodTitle
- type Header
- type HeaderParameter
- type Info
- type License
- type Link
- type Map
- func NewMap[T any, U any](m map[string]U, fn func(U) (T, error)) (Map[T], error)
- func NewMapEmpty[T any](size int) Map[T]
- func NewMapPrefix[T any, U any](m map[string]U, fn func(U) (T, error), prefix string) (zero Map[T], _ error)
- func NewMapRefSelf[T any, U any](m map[string]U, fn func(U) (ref string, _ Ref[T], _ error), prefix string) (Map[Ref[T]], error)
- func NewMapRefSelfSource[T any, U any](m map[string]U, fn func(U, Sourcer[T]) (ref string, _ Ref[T], _ error), ...) (zero Map[Ref[T]], _ error)
- type Maybe
- type MediaType
- type NoRef
- type OAuthFlow
- type OAuthFlows
- type Object
- type Operation
- type OperationParameters
- type PathItem
- type PathParameter
- type QueryParameter
- type Ref
- func NewRef[T any](v *Object[string, Ref[T]]) Ref[T]
- func NewRefCookieParam(p *openapi3.ParameterRef, components Components, opts SchemaOptions) (Ref[CookieParameter], error)
- func NewRefHeaderParam(p *openapi3.ParameterRef, components Components, opts SchemaOptions) (Ref[HeaderParameter], error)
- func NewRefPathParam(p *openapi3.ParameterRef, components Components, opts SchemaOptions) (Ref[PathParameter], error)
- func NewRefQueryParam(p *openapi3.ParameterRef, components Components, opts SchemaOptions) (Ref[QueryParameter], error)
- func NewSchemaRef(schema *openapi3.SchemaRef, components Sourcer[Schema], opts SchemaOptions) (Ref[Schema], error)
- type RequestBody
- type Response
- type ResponseUsedIn
- type Schema
- type SchemaOptions
- type SchemaProperty
- type Security
- type SecurityRequirement
- type SecurityRequirements
- type SecurityScheme
- type SecuritySchemeIn
- type SecuritySchemeType
- type SecuritySchemes
- type Server
- type ServerVariable
- type Sourcer
- type SourcerFunc
- type Spec
Constants ¶
View Source
const ExtGoagPrefix = "x-goag-"
View Source
const ExtTagGoTimeFormat = ExtGoagPrefix + "go-time-format"
View Source
const ExtTagGoType = ExtGoagPrefix + "go-type"
Variables ¶
This section is empty.
Functions ¶
func GetSecurity ¶ added in v0.0.12
func GetSecurity(secSchemes openapi3.SecuritySchemes, secRequirements openapi3.SecurityRequirements) ([][]Security, error)
Types ¶
type Components ¶ added in v0.0.11
type Components struct { Schemas ComponentsSchemas Headers Map[Ref[Header]] RequestBodies Map[Ref[RequestBody]] Responses Map[Ref[Response]] // ---------------- Parameters ---------------- QueryParameters Map[Ref[QueryParameter]] HeaderParameters Map[Ref[HeaderParameter]] PathParameters Map[Ref[PathParameter]] CookieParameters Map[Ref[CookieParameter]] SecuritySchemes SecuritySchemes Links Map[Ref[Link]] PathItems Map[Ref[PathItem]] }
func NewComponents ¶ added in v0.0.11
func NewComponents(spec openapi3.Components, opts SchemaOptions) (zero Components, _ error)
type ComponentsSchemas ¶ added in v0.0.14
type Contact ¶ added in v0.0.14
func NewContact ¶ added in v0.0.14
type CookieParameter ¶ added in v0.0.14
type CookieParameter struct { NoRef[CookieParameter] Name string Description string Required bool Deprecated bool Style string Explode Maybe[bool] Schema Ref[Schema] }
func NewCookieParameter ¶ added in v0.0.14
func NewCookieParameter(p *openapi3.Parameter, schemas ComponentsSchemas, opts SchemaOptions) (*CookieParameter, error)
func (*CookieParameter) Value ¶ added in v0.0.14
func (c *CookieParameter) Value() *CookieParameter
type HTTPMethod ¶ added in v0.0.14
type HTTPMethod string
HTTPMethod - http.MethodGet, http.MethodPost, ...
type HTTPMethodTitle ¶ added in v0.0.14
type HTTPMethodTitle string
HTTPMethodTitle - Get, Post, ...
type Header ¶
type Header struct { NoRef[Header] Description string Required bool Deprecated bool Schema Ref[Schema] }
func NewHeader ¶
func NewHeader(s *openapi3.Header, schemas ComponentsSchemas, opts SchemaOptions) (*Header, error)
type HeaderParameter ¶
type HeaderParameter struct { NoRef[HeaderParameter] Name string Description string Required bool Deprecated bool Style string Explode Maybe[bool] Schema Ref[Schema] }
func NewHeaderParameter ¶ added in v0.0.14
func NewHeaderParameter(p *openapi3.Parameter, schemas ComponentsSchemas, opts SchemaOptions) (*HeaderParameter, error)
func (*HeaderParameter) Value ¶ added in v0.0.14
func (h *HeaderParameter) Value() *HeaderParameter
type Info ¶ added in v0.0.10
type License ¶ added in v0.0.14
func NewLicense ¶ added in v0.0.14
type Map ¶ added in v0.0.14
func NewMapEmpty ¶ added in v0.0.14
func NewMapPrefix ¶ added in v0.0.14
func NewMapRefSelf ¶ added in v0.0.14
func NewMapRefSelfSource ¶ added in v0.0.14
type Maybe ¶ added in v0.1.5
func JustPointer ¶ added in v0.1.21
type MediaType ¶ added in v0.0.14
func NewMediaType ¶ added in v0.0.14
func NewMediaType(s *openapi3.MediaType, components ComponentsSchemas, opts SchemaOptions) (*MediaType, error)
type OAuthFlow ¶ added in v0.0.14
type OAuthFlows ¶ added in v0.0.14
type OAuthFlows struct { Implicit Maybe[OAuthFlow] Password Maybe[OAuthFlow] ClientCredentials Maybe[OAuthFlow] AuthorizationCode Maybe[OAuthFlow] }
func NewOAuthFlows ¶ added in v0.0.14
func NewOAuthFlows(s *openapi3.OAuthFlows) (zero OAuthFlows, _ error)
type Operation ¶
type Operation struct { PathItem *PathItem PathRaw string Tags []string Summary string Description string OperationID string Parameters OperationParameters RequestBody Maybe[Ref[RequestBody]] HTTPMethod HTTPMethod Method HTTPMethodTitle Security SecurityRequirements Responses Map[Ref[Response]] }
func NewOperation ¶
func NewOperation(pi *PathItem, rawPath string, method httpMethod, operation *openapi3.Operation, specSecurityReqs SecurityRequirements, legacyComponents openapi3.Components, securitySchemes SecuritySchemes, components Components, pathItemParameters openapi3.Parameters, opts SchemaOptions) (*Operation, error)
type OperationParameters ¶ added in v0.0.14
type OperationParameters struct { Query Map[Ref[QueryParameter]] Headers Map[Ref[HeaderParameter]] Path Map[Ref[PathParameter]] Cookie Map[Ref[CookieParameter]] }
func NewOperationParameters ¶ added in v0.0.14
func NewOperationParameters(pathParams, operationParams openapi3.Parameters, components Components, opts SchemaOptions) (zero OperationParameters, _ error)
type PathItem ¶
func NewPathItem ¶ added in v0.0.14
func (*PathItem) GetOperation ¶ added in v0.1.14
func (p *PathItem) GetOperation(m HTTPMethod) (*Operation, bool)
func (*PathItem) HasOperation ¶ added in v0.1.14
func (p *PathItem) HasOperation(m HTTPMethod) bool
type PathParameter ¶
type PathParameter struct { NoRef[PathParameter] Name string Description string Deprecated bool Style string Explode Maybe[bool] Schema Ref[Schema] }
func NewPathParameter ¶ added in v0.0.14
func NewPathParameter(p *openapi3.Parameter, schemas ComponentsSchemas, opts SchemaOptions) (*PathParameter, error)
func (*PathParameter) Value ¶ added in v0.0.14
func (p *PathParameter) Value() *PathParameter
type QueryParameter ¶
type QueryParameter struct { NoRef[QueryParameter] Name string Description string Required bool Deprecated bool AllowEmptyValue bool Style string Explode Maybe[bool] AllowReserved bool Schema Ref[Schema] }
func NewQueryParameter ¶ added in v0.0.14
func NewQueryParameter(p *openapi3.Parameter, schemas ComponentsSchemas, opts SchemaOptions) (*QueryParameter, error)
func (*QueryParameter) Value ¶ added in v0.0.14
func (q *QueryParameter) Value() *QueryParameter
type Ref ¶ added in v0.0.14
func NewRefCookieParam ¶ added in v0.0.14
func NewRefCookieParam(p *openapi3.ParameterRef, components Components, opts SchemaOptions) (Ref[CookieParameter], error)
func NewRefHeaderParam ¶ added in v0.0.14
func NewRefHeaderParam(p *openapi3.ParameterRef, components Components, opts SchemaOptions) (Ref[HeaderParameter], error)
func NewRefPathParam ¶ added in v0.0.14
func NewRefPathParam(p *openapi3.ParameterRef, components Components, opts SchemaOptions) (Ref[PathParameter], error)
func NewRefQueryParam ¶ added in v0.0.14
func NewRefQueryParam(p *openapi3.ParameterRef, components Components, opts SchemaOptions) (Ref[QueryParameter], error)
func NewSchemaRef ¶ added in v0.0.14
type RequestBody ¶ added in v0.0.14
type RequestBody struct { NoRef[RequestBody] Description string Content Map[*MediaType] Required bool }
func NewRequestBody ¶ added in v0.0.14
func NewRequestBody(r *openapi3.RequestBody, components ComponentsSchemas, opts SchemaOptions) (*RequestBody, error)
func (*RequestBody) Value ¶ added in v0.0.14
func (r *RequestBody) Value() *RequestBody
type Response ¶
type Response struct { NoRef[Response] Description string Headers Map[Ref[Header]] Content Map[*MediaType] Links Map[Ref[Link]] UsedIn []ResponseUsedIn }
func NewResponse ¶
func NewResponse(s *openapi3.Response, components Components, opts SchemaOptions) (*Response, error)
type ResponseUsedIn ¶ added in v0.1.8
type Schema ¶
type Schema struct { NoRef[Schema] Type string Format string Items Ref[Schema] Properties []SchemaProperty AllOf []Ref[Schema] Description string Nullable bool AdditionalProperties Maybe[Ref[Schema]] Custom Maybe[string] Extentions map[string]string }
type SchemaOptions ¶ added in v0.1.18
type SchemaOptions struct {
IgnoreCustomType bool
}
type SchemaProperty ¶ added in v0.0.11
type SecurityRequirement ¶ added in v0.0.14
type SecurityRequirement struct { Scheme *SecurityScheme Requirements []string }
func NewSecurityRequirement ¶ added in v0.0.14
func NewSecurityRequirement(k string, v []string, schemes SecuritySchemes) (zero SecurityRequirement, _ error)
func NewSecurityRequirements ¶ added in v0.0.14
func NewSecurityRequirements(s openapi3.SecurityRequirements, schemes SecuritySchemes) ([]SecurityRequirement, error)
type SecurityRequirements ¶ added in v0.0.14
type SecurityRequirements []SecurityRequirement
type SecurityScheme ¶ added in v0.0.14
type SecurityScheme struct { NoRef[SecurityScheme] // Any Type SecuritySchemeType Description string // apiKey Name string In SecuritySchemeIn // http Scheme string BearerFormat string // oauth2 Flows OAuthFlows // openIdConnect OpenIDConnectURL string }
func NewSecurityScheme ¶ added in v0.0.14
func NewSecurityScheme(s *openapi3.SecurityScheme) (*SecurityScheme, error)
func (*SecurityScheme) Value ¶ added in v0.0.14
func (s *SecurityScheme) Value() *SecurityScheme
type SecuritySchemeIn ¶ added in v0.0.14
type SecuritySchemeIn string
const ( SecuritySchemeInQuery SecuritySchemeIn = "query" SecuritySchemeInHeader SecuritySchemeIn = "header" SecuritySchemeInCookie SecuritySchemeIn = "cookie" )
type SecuritySchemeType ¶ added in v0.0.14
type SecuritySchemeType string
const ( SecuritySchemeTypeApiKey SecuritySchemeType = "apiKey" SecuritySchemeTypeHTTP SecuritySchemeType = "http" SecuritySchemeTypeMutualTLS SecuritySchemeType = "mutualTLS" SecuritySchemeTypeOAuth2 SecuritySchemeType = "oauth2" SecuritySchemeTypeOpenIDConnect SecuritySchemeType = "openIdConnect" )
type SecuritySchemes ¶ added in v0.0.14
type SecuritySchemes = Map[Ref[SecurityScheme]]
type Server ¶ added in v0.0.14
type Server struct { URL string Description string Variables Map[ServerVariable] }
type ServerVariable ¶ added in v0.0.14
func NewServerVariable ¶ added in v0.0.14
func NewServerVariable(sv *openapi3.ServerVariable) ServerVariable
type SourcerFunc ¶ added in v0.1.8
type Spec ¶
type Spec struct { OpenAPI string Info Info Servers []Server PathItems []*PathItem Operations []*Operation Components Components Security []SecurityRequirement }
func ParseSwagger ¶
func ParseSwagger(spec *openapi3.Swagger, opts SchemaOptions) (*Spec, error)
Click to show internal directories.
Click to hide internal directories.