models

package
v0.0.0-...-4a5d62a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APISpecInfo

type APISpecInfo struct {
	Title       string `json:"title" yaml:"title"`
	Description string `json:"description" yaml:"description"`
	APIVersion  string `json:"version" yaml:"version"`
}

type Application

type Application struct {
	Name   string                 `json:"name"`
	Config map[string]interface{} `json:"config"`
}

type Documentation

type Documentation struct {
	Version     string  `json:"version,omitempty" yaml:"version,omitempty"`
	Title       string  `json:"title,omitempty" yaml:"title,omitempty"`
	Description string  `json:"description,omitempty" yaml:"description,omitempty"`
	Models      []Model `json:"models,omitempty" yaml:"models,omitempty"`
}

type Event

type Event struct {
	Method        string                `json:"method,omitempty" yaml:"method,omitempty"`
	Fn            FnFunction            `json:"fn" yaml:"fn"`
	Documentation FunctionDocumentation `json:"documentation,omitempty" yaml:"documentation,omitempty"`
}

type Fn

type Fn struct {
	Functions   map[string]Function `json:"functions,omitempty" yaml:"functions,omitempty"`
	Version     string              `json:"version" yaml:"version"`
	Description string              `json:"description" yaml:"description"`
}

func (*Fn) Marshal

func (fn *Fn) Marshal(w io.Writer) error

func (*Fn) Unmarshal

func (fn *Fn) Unmarshal(content []byte, w io.Writer) error

func (*Fn) Validate

func (fn *Fn) Validate() bool

type FnFunction

type FnFunction struct {
	Application Application            `json:"application" yaml:"application"`
	Name        string                 `json:"name" yaml:"name,omitempty"`
	Version     string                 `json:"version" yaml:"version,omitempty"`
	Path        string                 `json:"path,omitempty" yaml:"path,omitempty"`
	Image       string                 `json:"image,omitempty" yaml:"image,omitempty"`
	Timeout     int32                  `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	IdleTimeout int32                  `json:"idle_timeout,omitempty" yaml:"idle_timeout,omitempty"`
	Memory      int32                  `json:"memory,omitempty" yaml:"memory,omitempty"`
	Type        string                 `json:"type,omitempty" yaml:"type,omitempty"`
	Config      map[string]interface{} `json:"config" yaml:"config"`
}

func (*FnFunction) UnmarshalYAML

func (fn *FnFunction) UnmarshalYAML(unmarshal func(interface{}) error) error

type Function

type Function struct {
	Handler string             `json:"handler,omitempty" yaml:"handler,omitempty"`
	Events  []map[string]Event `json:"events,omitempty" yaml:"events,omitempty"`
}

func (*Function) ValidateEventTypes

func (f *Function) ValidateEventTypes() bool

type FunctionDocumentation

type FunctionDocumentation struct {
	Summary     string           `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description string           `json:"description,omitempty" yaml:"description,omitempty"`
	RequestBody PayloadSchema    `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Parameters  []Parameter      `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Responses   map[int]Response `json:"responses,omitempty" yaml:"responses,omitempty"`
}

type Model

type Model struct {
	Name        string `json:"name,omitempty" yaml:"name,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"`
	Schema      Schema `json:"schema,omitempty" yaml:"schema,omitempty"`
}

type OpenAPISpec

type OpenAPISpec struct {
	Version     string                   `json:"openapi" yaml:"openapi"`
	Servers     []Server                 `json:"servers" yaml:"servers"`
	APISpecInfo APISpecInfo              `json:"info" yaml:"info"`
	Paths       map[string]PathItemProps `json:"paths" yaml:"paths"`
}

func (*OpenAPISpec) FromFnSpec

func (oai *OpenAPISpec) FromFnSpec(fnAPIURL string, fn *Fn) error

func (*OpenAPISpec) Marshal

func (oia *OpenAPISpec) Marshal(w io.Writer) error

type OperationProperties

type OperationProperties struct {
	Description string                `json:"description,omitempty" yaml:"description,omitempty"`
	Consumes    []string              `json:"consumes,omitempty" yaml:"consumes,omitempty"`
	Produces    []string              `json:"produces,omitempty" yaml:"produces,omitempty"`
	Schemes     []string              `json:"schemes,omitempty" yaml:"schemes,omitempty"` // the scheme, when present must be from [http, https, ws, wss]
	Summary     string                `json:"summary,omitempty" yaml:"summary,omitempty"`
	ID          string                `json:"operationId,omitempty" yaml:"operationId,omitempty"`
	Security    []map[string][]string `json:"security,omitempty" yaml:"security,omitempty"`
	Parameters  []Parameter           `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Responses   map[int]Response      `json:"responses,omitempty" yaml:"responses,omitempty"`
}

type Parameter

type Parameter struct {
	Description      string       `json:"description,omitempty" yaml:"description,omitempty"`
	Name             string       `json:"name,omitempty" yaml:"name,omitempty"`
	In               string       `json:"in,omitempty" yaml:"in,omitempty"`
	Required         bool         `json:"required,omitempty" yaml:"required,omitempty"`
	Schema           SimpleSchema `json:"schema,omitempty" yaml:"schema,omitempty"`
	AllowEmptyValue  bool         `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	Type             string       `json:"type,omitempty" yaml:"type,omitempty"`
	Format           string       `json:"format,omitempty" yaml:"format,omitempty"`
	Items            *spec.Items  `json:"items,omitempty" yaml:"items,omitempty"`
	CollectionFormat string       `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty"`
	Default          interface{}  `json:"default,omitempty" yaml:"default,omitempty"`
}

type PathItemProps

type PathItemProps struct {
	Get        *OperationProperties `json:"get,omitempty" yaml:"get,omitempty"`
	Put        *OperationProperties `json:"put,omitempty" yaml:"put,omitempty"`
	Post       *OperationProperties `json:"post,omitempty" yaml:"post,omitempty"`
	Delete     *OperationProperties `json:"delete,omitempty" yaml:"delete,omitempty"`
	Options    *OperationProperties `json:"options,omitempty" yaml:"options,omitempty"`
	Head       *OperationProperties `json:"head,omitempty" yaml:"head,omitempty"`
	Patch      *OperationProperties `json:"patch,omitempty" yaml:"patch,omitempty"`
	Parameters []spec.Parameter     `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

type PayloadSchema

type PayloadSchema struct {
	Schema Schema `json:"schema"`
}

type RequestResponseBody

type RequestResponseBody struct {
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type Response

type Response struct {
	Description string                   `json:"description,omitempty"`
	Content     map[string]PayloadSchema `json:"content"`
}

type Schema

type Schema struct {
	spec.Schema
}

func (*Schema) UnmarshalYAML

func (schema *Schema) UnmarshalYAML(unmarshal func(interface{}) error) error

type Server

type Server struct {
	URL string `json:"url"`
}

type SimpleSchema

type SimpleSchema struct {
	spec.SimpleSchema
	Maximum          *float64      `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	ExclusiveMaximum bool          `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
	Minimum          *float64      `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	ExclusiveMinimum bool          `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
	MaxLength        *int64        `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	MinLength        *int64        `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	Pattern          string        `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	MaxItems         *int64        `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	MinItems         *int64        `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	UniqueItems      bool          `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	MultipleOf       *float64      `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
	Enum             []interface{} `json:"enum,omitempty" yaml:"enum,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址