specification

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array[T any] []T

func (Array[T]) MarshalJSON

func (a Array[T]) MarshalJSON() ([]byte, error)

type DescriptionInfo

type DescriptionInfo struct {
	DocString string `json:"docString"`
	Markup    string `json:"markup"`
}

type Endpoint

type Endpoint struct {
	HostnamePattern    string        `json:"hostnamePattern"`
	PathMapping        string        `json:"pathMapping"`
	DefaultMimeType    string        `json:"defaultMimeType,omitempty"`
	AvailableMimeTypes Array[string] `json:"availableMimeTypes"`
	RegexPathPrefix    string        `json:"regexPathPrefix,omitempty"`
	Fragment           string        `json:"fragment,omitempty"`
}

type Enum

type Enum struct {
	Name            string          `json:"name"`
	Values          Array[Value]    `json:"values"`
	DescriptionInfo DescriptionInfo `json:"descriptionInfo"`
}

type Field

type Field struct {
	Name            string          `json:"name"`
	Location        FieldLocation   `json:"location"`
	Requirement     string          `json:"requirement"`
	TypeSignature   TypeSignature   `json:"typeSignature"`
	DescriptionInfo DescriptionInfo `json:"descriptionInfo"`
}

type FieldLocation

type FieldLocation int
const (
	FieldLocationUnspecified FieldLocation = iota
	FieldLocationPath
	FieldLocationHeader
	FieldLocationQuery
	FieldLocationBody
)

func (FieldLocation) MarshalJSON

func (l FieldLocation) MarshalJSON() ([]byte, error)

type Method

type Method struct {
	Name                    string                   `json:"name"`
	ID                      string                   `json:"id"`
	ReturnTypeSignature     TypeSignature            `json:"returnTypeSignature"`
	Parameters              Array[Field]             `json:"parameters"`
	UseParameterAsRoot      bool                     `json:"-"`
	ExceptionTypeSignatures Array[TypeSignature]     `json:"exceptionTypeSignatures"`
	Endpoints               Array[Endpoint]          `json:"endpoints"`
	ExampleHeaders          Array[map[string]string] `json:"exampleHeaders"`
	ExampleRequests         Array[string]            `json:"exampleRequests"`
	ExamplePaths            Array[string]            `json:"examplePaths"`
	ExampleQueries          Array[string]            `json:"exampleQueries"`
	HTTPMethod              string                   `json:"httpMethod"`
	DescriptionInfo         DescriptionInfo          `json:"descriptionInfo"`
}

type Service

type Service struct {
	Name            string                   `json:"name"`
	Methods         Array[Method]            `json:"methods"`
	ExampleHeaders  Array[map[string]string] `json:"exampleHeaders"`
	DescriptionInfo DescriptionInfo          `json:"descriptionInfo"`
}

type Specification

type Specification struct {
	Services       Array[Service]           `json:"services"`
	Enums          Array[Enum]              `json:"enums"`
	Structs        Array[Struct]            `json:"structs"`
	Exceptions     Array[Struct]            `json:"exceptions"`
	ExampleHeaders Array[map[string]string] `json:"exampleHeaders"`
}

type Struct

type Struct struct {
	Name            string          `json:"name"`
	Alias           string          `json:"alias,omitempty"`
	Fields          Array[Field]    `json:"fields"`
	DescriptionInfo DescriptionInfo `json:"descriptionInfo"`
}

type TypeSignature

type TypeSignature interface {
	Type() TypeSignatureType
	Signature() string
	MarshalJSON() ([]byte, error)
}

func NewEnumTypeSignature

func NewEnumTypeSignature(name string) TypeSignature

func NewIterableTypeSignature

func NewIterableTypeSignature(name string, itemType TypeSignature) TypeSignature

func NewMapTypeSignature

func NewMapTypeSignature(keyType TypeSignature, valueType TypeSignature) TypeSignature

func NewStructTypeSignature

func NewStructTypeSignature(name string) TypeSignature

type TypeSignatureType

type TypeSignatureType int
const (
	TypeSignatureTypeBase TypeSignatureType = iota
	TypeSignatureTypeStruct
	TypeSignatureTypeEnum
	TypeSignatureTypeIterable
	TypeSignatureTypeMap
)

type Value

type Value struct {
	Name            string          `json:"name"`
	IntValue        *int            `json:"intValue,omitempty"`
	DescriptionInfo DescriptionInfo `json:"descriptionInfo"`
}

Jump to

Keyboard shortcuts

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