definition

package
v0.0.0-...-36352f1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_PROTOCOL  = "http"
	HTTPS_PROTOCOL = "https"
)

Variables

This section is empty.

Functions

func CleanCustomTypeName

func CleanCustomTypeName(name string) string

CleanCustomTypeName It responsible for removing expressions

Types

type Api

type Api struct {
	Title             string
	Version           string
	BaseURI           string
	BaseURIParameters []Parameter
	Protocols         []Protocol
	MediaTypes        []MediaType
	CustomTypes       []CustomType
	Traits            []Trait
	SecuritySchemes   []SecurityScheme
	SecuredBy         []Option
	ResourceGroups    []ResourceGroup
}

Api Definition structure

func (Api) CustomTypeByName

func (def Api) CustomTypeByName(name string) (ct CustomType)

CustomTypeByName Returns a CustomType struct based on its name

type Body

type Body struct {
	Description string
	Type        string
	CustomType  *CustomType
	MediaType   MediaType
	Example     string
}

Body

type CustomType

type CustomType struct {
	Name        string
	Description string
	Type        interface{}
	Default     interface{}
	Enum        interface{}
	Properties  []CustomTypeProperty
	Examples    []interface{}
}

CustomType represents custom types

type CustomTypeProperty

type CustomTypeProperty struct {
	Name        string
	Type        string
	Required    bool
	Description string
	Example     string
	Properties  []CustomTypeProperty
}

CustomTypeProperty Represents a property of a custom type

type Header struct {
	Name        string
	Description string
	Example     interface{}
}

Header

type Href

type Href struct {
	FullPath   string
	Path       string
	Parameters []Parameter
}

Href

type MediaType

type MediaType string

MediaType represents the media types available on the API. e.g application/json

type Option

type Option struct {
	Name       string
	Parameters map[string]interface{}
}

Option

type Parameter

type Parameter struct {
	Name        string
	Description string
	Type        string
	Required    bool
	Pattern     *string
	MinLength   *int
	MaxLength   *int
	Min         *float64
	Max         *float64
	Example     interface{}
}

Parameter

type Protocol

type Protocol string

Protocol

func NewProtocolFromURL

func NewProtocolFromURL(URL string) (proto Protocol, err error)

NewProtocolFromURL Returns the protocol based on the URL

type Request

type Request struct {
	Title       string
	Description string
	Body        []Body
	Headers     []Header
}

Request

type Resource

type Resource struct {
	Title       string
	Description string
	Href        Href
	Is          []Option
	SecuredBy   []Option
	Actions     []ResourceAction
	Resources   []Resource
}

Resource represents a resource. e.g. /examples

type ResourceAction

type ResourceAction struct {
	Title        string
	Description  string
	Method       string
	Href         Href
	Is           []Option
	SecuredBy    []Option
	Transactions []Transaction
}

ResourceAction represents an action for a resource. e.g. GET /examples or POST /examples

type ResourceGroup

type ResourceGroup struct {
	Title       string
	Description string
	Resources   []Resource
}

ResourceGroup groups logically bound resources

type Response

type Response struct {
	StatusCode  int
	Description string
	Headers     []Header
	Body        []Body
}

Response

type SecurityScheme

type SecurityScheme struct {
	Name         string
	Description  string
	Type         string
	Transactions []Transaction
	Settings     []SecuritySchemeSetting
}

SecurityScheme

type SecuritySchemeSetting

type SecuritySchemeSetting struct {
	Name string
	Data interface{}
}

Setting

type Trait

type Trait struct {
	Name         string
	Usage        string
	Description  string
	Protocols    []Protocol
	Href         Href
	Transactions []Transaction
}

Trait Optional definition that

type Transaction

type Transaction struct {
	Request  Request
	Response Response
}

Transaction groups a pair request/response

Jump to

Keyboard shortcuts

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