Documentation
¶
Index ¶
- Constants
- type ComponentsObject
- type ContactObject
- type HeaderObject
- type InfoObject
- type LicenseObject
- type MediaTypeObject
- type OpenAPIObject
- type OperationObject
- type ParameterObject
- type PathItemObject
- type PathsObject
- type RequestBodyObject
- type ResponseObject
- type ResponsesObject
- type SchemaObject
- type SecuritySchemeOauthFlowObject
- type SecuritySchemeOauthObject
- type SecuritySchemeObject
- type ServerObject
Constants ¶
View Source
const ( OpenAPIVersion = "3.0.0" ContentTypeText = "text/plain" ContentTypeJson = "application/json" ContentTypeForm = "multipart/form-data" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComponentsObject ¶
type ComponentsObject struct {
Schemas map[string]*SchemaObject `json:"schemas,omitempty"`
SecuritySchemes map[string]*SecuritySchemeObject `json:"securitySchemes,omitempty"`
Parameters map[string]*ParameterObject `json:"parameters,omitempty"`
}
type ContactObject ¶
type HeaderObject ¶
type InfoObject ¶
type InfoObject struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
TermsOfService string `json:"termsOfService,omitempty"`
Contact *ContactObject `json:"contact,omitempty"`
License *LicenseObject `json:"license,omitempty"`
Version string `json:"version"`
}
type LicenseObject ¶
type MediaTypeObject ¶
type MediaTypeObject struct {
Schema SchemaObject `json:"schema,omitempty"`
}
type OpenAPIObject ¶
type OpenAPIObject struct {
Version string `json:"openapi"` // Required
Info InfoObject `json:"info"` // Required
Servers []ServerObject `json:"servers,omitempty"`
Paths PathsObject `json:"paths"` // Required
Components ComponentsObject `json:"components,omitempty"` // Required for Authorization header
Security []map[string][]string `json:"security,omitempty"`
}
type OperationObject ¶
type OperationObject struct {
Responses ResponsesObject `json:"responses"` // Required
Tags []string `json:"tags,omitempty"`
Summary string `json:"summary,omitempty"`
Description string `json:"description,omitempty"`
Parameters []ParameterObject `json:"parameters,omitempty"`
RequestBody *RequestBodyObject `json:"requestBody,omitempty"`
OperationID string `json:"operationId,omitempty"`
}
type ParameterObject ¶
type ParameterObject struct {
Name string `json:"name,omitempty"` // Required
In string `json:"in,omitempty"` // Required. Possible values are "query", "header", "path" or "cookie"
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
Example interface{} `json:"example,omitempty"`
Schema *SchemaObject `json:"schema,omitempty"`
// Ref is used when ParameterOjbect is as a ReferenceObject
Ref string `json:"$ref,omitempty"`
}
type PathItemObject ¶
type PathItemObject struct {
Ref string `json:"$ref,omitempty"`
Summary string `json:"summary,omitempty"`
Description string `json:"description,omitempty"`
Get *OperationObject `json:"get,omitempty"`
Post *OperationObject `json:"post,omitempty"`
Patch *OperationObject `json:"patch,omitempty"`
Put *OperationObject `json:"put,omitempty"`
Delete *OperationObject `json:"delete,omitempty"`
Options *OperationObject `json:"options,omitempty"`
Head *OperationObject `json:"head,omitempty"`
Trace *OperationObject `json:"trace,omitempty"`
}
type PathsObject ¶
type PathsObject map[string]*PathItemObject
type RequestBodyObject ¶
type RequestBodyObject struct {
Content map[string]*MediaTypeObject `json:"content"` // Required
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
// Ref is used when RequestBodyObject is as a ReferenceObject
Ref string `json:"$ref,omitempty"`
}
type ResponseObject ¶
type ResponseObject struct {
Description string `json:"description"` // Required
Headers map[string]*HeaderObject `json:"headers,omitempty"`
Content map[string]*MediaTypeObject `json:"content,omitempty"`
// Ref is for ReferenceObject
Ref string `json:"$ref,omitempty"`
}
type ResponsesObject ¶
type ResponsesObject map[string]*ResponseObject // [status]ResponseObject
type SchemaObject ¶
type SchemaObject struct {
ID string `json:"-"` // For go-swagger3
PkgName string `json:"-"` // For go-swagger3
FieldName string `json:"-"` // For go-swagger3
DisabledFieldNames map[string]struct{} `json:"-"` // For go-swagger3
Type string `json:"type,omitempty"`
Format string `json:"format,omitempty"`
Required []string `json:"required,omitempty"`
Properties *orderedmap.OrderedMap `json:"properties,omitempty"`
Description string `json:"description,omitempty"`
Items *SchemaObject `json:"items,omitempty"` // use ptr to prevent recursive error
Example interface{} `json:"example,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
Ref string `json:"$ref,omitempty"` // Ref is used when SchemaObject is as a ReferenceObject
Enum interface{} `json:"enum,omitempty"`
Title string `json:"title,omitempty"`
Maximum float64 `json:"maximum,omitempty"`
ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
Minimum float64 `json:"minimum,omitempty"`
ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
MaxLength uint `json:"maxLength,omitempty"`
MinLength uint `json:"minLength,omitempty"`
Pattern string `json:"pattern,omitempty"`
MaxItems uint `json:"maxItems,omitempty"`
MinItems uint `json:"minItems,omitempty"`
UniqueItems bool `json:"uniqueItems,omitempty"`
MaxProperties uint `json:"maxProperties,omitempty"`
MinProperties uint `json:"minProperties,omitempty"`
AdditionalProperties bool `json:"additionalProperties,omitempty"`
Nullable bool `json:"nullable,omitempty"`
ReadOnly bool `json:"readOnly,omitempty"`
WriteOnly bool `json:"writeOnly,omitempty"`
}
type SecuritySchemeOauthObject ¶
type SecuritySchemeOauthObject struct {
Implicit *SecuritySchemeOauthFlowObject `json:"implicit,omitempty"`
AuthorizationCode *SecuritySchemeOauthFlowObject `json:"authorizationCode,omitempty"`
ResourceOwnerPassword *SecuritySchemeOauthFlowObject `json:"password,omitempty"`
ClientCredentials *SecuritySchemeOauthFlowObject `json:"clientCredentials,omitempty"`
}
func (*SecuritySchemeOauthObject) ApplyScopes ¶
func (s *SecuritySchemeOauthObject) ApplyScopes(scopes map[string]string)
type SecuritySchemeObject ¶
type SecuritySchemeObject struct {
// Generic fields
Type string `json:"type"` // Required
Description string `json:"description,omitempty"`
// http
Scheme string `json:"scheme,omitempty"`
// apiKey
In string `json:"in,omitempty"`
Name string `json:"name,omitempty"`
// OpenID
OpenIdConnectUrl string `json:"openIdConnectUrl,omitempty"`
// OAuth2
OAuthFlows *SecuritySchemeOauthObject `json:"flows,omitempty"`
}
type ServerObject ¶
Click to show internal directories.
Click to hide internal directories.