annotation

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptionNoBody = "-"
)

Variables

This section is empty.

Functions

func GetDescriptionFromDoc

func GetDescriptionFromDoc(doc []string) string

func ParseMetadata

func ParseMetadata(doc []string) (*spec.Metadata, error)

ParseMetadata parses doc per the format as below:

<property>=<value>

func ParseParamOptions

func ParseParamOptions(argName, s string) ([]*spec.Parameter, error)

func ParseSuccess

func ParseSuccess(s string, method *ifacetool.Method) (*spec.Response, error)

ParseSuccess parses s per the format as below:

statusCode=<statusCode> body=<body> manip=`<manipulation> [; <manipulation2> [; ...]]`

The format of `<manipulation>`:

<argName> name=<name> type=<type> descr=<descr>

Types

type Aliases

type Aliases map[string]string

func ParseAliases

func ParseAliases(doc []string) (Aliases, error)

ParseAliases parses doc per the format as below:

<name>=`<value>`

func (Aliases) Eval

func (a Aliases) Eval(value string) (string, error)

Eval replaces all possible aliases with their values.

func (Aliases) Set

func (a Aliases) Set(key, value string)

type Body

type Body struct {
	Field         string
	Manipulations map[string]*Manipulation
}

func ParseBody

func ParseBody(s string) (*Body, error)

ParseBody parses s per the format as below:

<field> or <manipulation> [; <manipulation2> [; ...]]

The format of `<manipulation>`:

<argName> name=<name> type=<type> descr=<descr>

type InterfaceAnnotation

type InterfaceAnnotation struct {
	Metadata *spec.Metadata
	Aliases  Aliases
}

func ParseInterfaceAnnotation

func ParseInterfaceAnnotation(doc []string) (*InterfaceAnnotation, error)

type Manipulation

type Manipulation struct {
	Name        string
	Type        string
	Description string
}

type MethodAnnotation

type MethodAnnotation struct {
	Ops     []*Op
	Params  map[string]*Param
	Body    *Body
	Success *spec.Response
	Tags    []string
}

func ParseMethodAnnotation

func ParseMethodAnnotation(method *ifacetool.Method, aliases Aliases) (*MethodAnnotation, error)

type Op

type Op struct {
	Method  string
	Pattern string
}

func ParseOp

func ParseOp(s string) (*Op, error)

ParseOp parses s per the format as below:

<method> <pattern>

type Param

type Param struct {
	ArgName string
	Params  []*spec.Parameter
}

func ParseParams

func ParseParams(s string) ([]*Param, error)

ParseParams parses s per the format as below:

<argName> [<parameter> [, <parameter2> [, ...]]]

The format of `<parameter>`:

in=<in> name=<name> required=<required> type=<type> descr=<descr>

Multiple bindings can be specified in a single semicolon-separated comment.

Jump to

Keyboard shortcuts

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