capsules

package
Version: v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: Apache-2.0 Imports: 0 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseCapsule

type BaseCapsule struct {
	*CapsulePowder
}

BaseCapsule provides necessary data to fill the template.

type Capsule

type Capsule interface {
	SetData(specData *Data)
	SetMode(templateID string, subServiceID ...string)
}

Capsule defines the common functions to implement for generator.

type CapsulePowder

type CapsulePowder struct {
	Data *Data

	CurrentTemplateID   string
	CurrentSubServiceID string
}

CapsulePowder provides necessary data to fill the template.

func (*CapsulePowder) SetData

func (c *CapsulePowder) SetData(specData *Data)

SetData sets the API spec data.

func (*CapsulePowder) SetMode

func (c *CapsulePowder) SetMode(templateID string, subServiceID ...string)

SetMode sets the template ID and sub service ID.

type CommonValidations added in v0.2.8

type CommonValidations struct {
	Maximum          *float64
	ExclusiveMaximum bool
	Minimum          *float64
	ExclusiveMinimum bool
	MaxLength        *int64
	MinLength        *int64
	Pattern          string
	MaxItems         *int64
	MinItems         *int64
	UniqueItems      bool
	MultipleOf       *float64
	Enum             []string
}

CommonValidations describes validations info of a property.

type Data

type Data struct {
	Service         *Service
	SubServices     map[string]*SubService
	CustomizedTypes map[string]*Property

	MetaData map[string]interface{}
}

Data stores the data of an API service to render.

type Operation

type Operation struct {
	ID               string
	Name             string
	Consumes         []string
	Description      string
	DocumentationURL string
	Request          *Request
	Responses        map[int]*Response
}

Operation stores the data of an operation.

type Property

type Property struct {
	ID               string
	Name             string
	Description      string
	Type             string
	ExtraType        string
	Format           string
	CollectionFormat string
	Default          string
	IsRequired       bool
	Properties       map[string]*Property

	Items *Property

	CommonValidations
}

Property describes info of a property.

type Request

type Request struct {
	Method     string
	Path       string
	Properties *Property
	Query      *Property
	Headers    *Property
	FormData   *Property
	Elements   *Property
	Body       *Property
}

Request stores the data of request section.

type Response

type Response struct {
	StatusCode *StatusCode
	Headers    *Property
	Elements   *Property
	Body       *Property
}

Response stores the data of response section.

type Service

type Service struct {
	APIVersion  string
	Name        string
	BasePath    string
	Description string
	Properties  *Property
	Operations  map[string]*Operation
}

Service stores the data of a service.

type StatusCode

type StatusCode struct {
	Code        int
	Description string
}

StatusCode stores the data of status code.

type SubService

type SubService struct {
	ID         string
	Name       string
	Properties *Property
	Operations map[string]*Operation
}

SubService stores the data of an sub service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL