types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contact

type Contact struct {
	Name  string `json:"name,omitempty"`
	URL   string `json:"url,omitempty"`
	Email string `json:"email,omitempty"`
}

type Example

type Example struct {
	Ref         string `json:"$ref,omitempty"`
	Name        string `json:"name"`
	Summary     string `json:"summary,omitempty"`
	Description string `json:"description,omitempty"`
	Value       any    `json:"value"`
}

type ExamplePairing

type ExamplePairing struct {
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	Summary     string    `json:"summary,omitempty"`
	Params      []Example `json:"params"`
	Result      Example   `json:"result"`
}

type ExternalDocumentation

type ExternalDocumentation struct {
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
}

type Info

type Info struct {
	Title       string        `json:"title"`
	Description string        `json:"description"`
	Version     string        `json:"version"`
	Contact     Contact       `json:"contact,omitempty"`
	Socials     []*SocialInfo `json:"x-social,omitempty"`
}

type Items

type Items []Schema

func (*Items) UnmarshalJSON

func (I *Items) UnmarshalJSON(b []byte) error

type Method

type Method struct {
	Name     string           `json:"name"`
	Tags     []Tag            `json:"tags,omitempty"`
	Summary  string           `json:"summary"`
	Params   []Param          `json:"params"`
	Result   Result           `json:"result"`
	Examples []ExamplePairing `json:"examples,omitempty"`
}

func (*Method) MethodName

func (m *Method) MethodName() string

func (*Method) Namespace

func (m *Method) Namespace() string

type OpenRPC

type OpenRPC struct {
	Package    string   `json:"-"`
	Version    string   `json:"openrpc"`
	Info       Info     `json:"info"`
	Methods    []Method `json:"methods"`
	Servers    []Server `json:"servers"`
	Components struct {
		Schemas map[string]Schema `json:"schemas"`
	} `json:"components"`
}

func NewOpenRPCSpec1

func NewOpenRPCSpec1() *OpenRPC

func (*OpenRPC) AddMethod

func (o *OpenRPC) AddMethod(pth string) error

func (*OpenRPC) AddMethods

func (o *OpenRPC) AddMethods(pth string) error

func (*OpenRPC) AddSchema

func (o *OpenRPC) AddSchema(pth string) error

func (*OpenRPC) AddSchemas

func (o *OpenRPC) AddSchemas(pth string) error

type Param

type Param struct {
	Name        string `json:"name"`
	Summary     string `json:"summary,omitempty"`
	Description string `json:"description,omitempty"`
	Required    bool   `json:"required"`
	Schema      Schema `json:"schema"`
}

type Result

type Result struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Schema      Schema `json:"schema"`
}

type Schema

type Schema struct {
	Ref         string            `json:"$ref,omitempty"`
	Description string            `json:"description,omitempty"`
	Type        string            `json:"type,omitempty"`
	Title       string            `json:"title,omitempty"`
	Required    []string          `json:"required,omitempty"`
	Items       Items             `json:"items,omitempty"`
	Properties  map[string]Schema `json:"properties,omitempty"`
	OneOf       []Schema          `json:"oneOf,omitempty"`
	AnyOf       []Schema          `json:"anyOf,omitempty"`
	AllOf       []Schema          `json:"allOf,omitempty"`
	Enum        []string          `json:"enum,omitempty"`
	Pattern     string            `json:"pattern,omitempty"`
}

type Server

type Server struct {
	Name        string                    `json:"name"`
	URL         string                    `json:"url"`
	Summary     string                    `json:"summary,omitempty"`
	Description string                    `json:"description,omitempty"`
	Variables   map[string]ServerVariable `json:"variables,omitempty"`
}

type ServerVariable

type ServerVariable struct {
	Enum        []string `json:"enum,omitempty"`
	Default     string   `json:"default,omitempty"`
	Description string   `json:"description,omitempty"`
}

type SocialInfo

type SocialInfo struct {
	Name  string `json:"name"`
	URL   string `json:"url"`
	Color string `json:"color"`
}

type Tag

type Tag struct {
	Ref          string                 `json:"$ref,omitempty"`
	Name         string                 `json:"name"`
	Summary      string                 `json:"summary,omitempty"`
	Description  string                 `json:"description,omitempty"`
	ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
}

Jump to

Keyboard shortcuts

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