Documentation ¶
Index ¶
- Constants
- func Endpoints(schemas ...map[string]Path) map[string]Path
- func RequiredFrom(obj interface{}) []string
- type Components
- type Contact
- type FieldProperty
- type Info
- type License
- type MediaType
- type Operation
- type Path
- type Properties
- type Property
- type Ref
- type Request
- type Response
- type ResponseRefs
- type Schema
- type Security
- type SecurityScheme
- type SecuritySpec
- type Server
- type Spec
- type Tag
Constants ¶
const ApplicationJSON = "application/json"
ApplicationJSON is a media type
Variables ¶
This section is empty.
Functions ¶
func RequiredFrom ¶
func RequiredFrom(obj interface{}) []string
RequiredFrom retrievs every property where omitempty is not set
Types ¶
type Components ¶
type Components struct { Schemas map[string]Schema `json:"schemas"` Responses map[string]Response `json:"responses"` // Parameters map[string]Parameter `json:"parameters"` // Examples map[string]Example `json:"examples"` // RequestBodies map[string]RequestBody `json:"requestBodies"` // Headers map[string]Headers `json:"headers"` SecuritySchemes map[string]SecurityScheme `json:"securitySchemes"` }
Components describe the components object
type Contact ¶
type Contact struct { Name string `json:"name"` URL string `json:"url"` Email string `json:"email"` }
Contact information
type FieldProperty ¶
type FieldProperty map[string]interface{}
FieldProperty is a free form property
type Info ¶
type Info struct { Title string `json:"title"` Version string `json:"version"` License License `json:"license"` Description string `json:"description"` Contact Contact `json:"contact"` }
Info about the API
type MediaType ¶
type MediaType struct { Schema interface{} `json:"schema"` Description string `json:"description,omitempty"` }
MediaType is the body of a respones object, e.g. a JSON payload with a schema. All schemas here are referenced.
type Operation ¶
type Operation struct { Description string `json:"description"` Responses ResponseRefs `json:"responses"` OperationID string `json:"operationId"` Parameters []Schema `json:"parameters,omitempty"` RequestBody *Request `json:"requestBody,omitempty"` Summary string `json:"summary,omitempty"` Tags []string `json:"tags,omitempty"` }
An Operation describes an api endpoint in a mapping of HTTP verb to sdescription
type Properties ¶
type Properties map[string]interface{}
Properties is a key value mapping from string to property
func PropertiesFrom ¶
func PropertiesFrom(obj interface{}) Properties
PropertiesFrom produces schema properties
type Property ¶
type Property struct { Type string `json:"type"` Format string `json:"format,omitempty"` Description string `json:"description"` }
Property of an object
type Ref ¶
type Ref struct {
Ref string `json:"$ref"`
}
Ref is a reference within the openapi document
func ResponseRef ¶
ResponseRef is a reference to a response defined in components
type Response ¶
type Response struct { Description string `json:"description"` Content map[string]MediaType `json:"content,omitempty"` }
Response encode a mapping between a status code and a media type object
type ResponseRefs ¶
ResponseRefs is a mapping from status code to a response reference
type Schema ¶
type Schema map[string]interface{}
Schema defines an api object
func ArraySchema ¶
ArraySchema creates a schema for an array type
func ObjectSchema ¶
ObjectSchema creates a new schema from an object
func ParamQuery ¶
ParamQuery creates a query parameter
func (Schema) RequireFrom ¶
RequireFrom sets required field from an object
type SecurityScheme ¶
type SecurityScheme struct { Type string `json:"type"` Description string `json:"description"` // Name string `json:"name"` // In string `json:"in"` // query, header cookie Scheme string `json:"scheme"` // RFC7235 BearerFormat string `json:"bearerFormat"` }
SecurityScheme describes a security scheme
type Spec ¶
type Spec struct { OpenAPI string `json:"openapi"` // Version Info Info `json:"info"` Paths map[string]Path `json:"paths"` Components Components `json:"components"` Tags []Tag `json:"tags"` Servers []Server `json:"servers,omitempty"` Security Security `json:"security"` }
Spec is the OpenAPI document describing the b3scale API