markdown

package
v0.0.0-...-e3fdd94 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterSchema

func FilterSchema(schema string) string

func FormatAnchor

func FormatAnchor(schema string) string

func RenderFromJSON

func RenderFromJSON(w Writer, r io.Reader, tmpl *Template) error

func RenderFromYAML

func RenderFromYAML(w Writer, r io.Reader, tmpl *Template) error

Types

type API

type API struct {
	Swagger     string                `json,yaml:"swagger"`
	Info        Info                  `json,yaml:"info"`
	Host        string                `json,yaml:"host"`
	BasePath    string                `json,yaml:"basePath"`
	Schemes     []string              `json,yaml:"schemes"`
	Consumes    []string              `json,yaml:"consumes"`
	Produces    []string              `json,yaml:"produces"`
	Paths       map[string]Methods    `json,yaml:"paths"`
	Definitions map[string]Definition `json,yaml:"definitions"`
}

func DecodeJSON

func DecodeJSON(data []byte) (*API, error)

func DecodeYAML

func DecodeYAML(data []byte) (*API, error)

type APIError

type APIError map[string]string

type Contact

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

type Definition

type Definition struct {
	Type       string                  `json,yaml:"type"`
	Properties map[string]SchemaObject `json,yaml:"properties"`
}

type Info

type Info struct {
	Version        string  `json,yaml:"version"`
	Title          string  `json,yaml:"title"`
	Description    string  `json,yaml:"description"`
	TermsOfService string  `json,yaml:"termsOfService"`
	Contact        Contact `json,yaml:"contact"`
	License        License `json,yaml:"license"`
}

type License

type License struct {
	Name string `json,yaml:"name"`
	URL  string `json,yaml:"url"`
}

type Methods

type Methods map[string]*Operation

type Operation

type Operation struct {
	API         *API
	Operation   string
	Path        string
	Tags        []string              `json,yaml:"tags"`
	Description string                `json,yaml:"description"`
	OperationID string                `json,yaml:"operationId"`
	Summary     string                `json,yaml:"summary"`
	Parameters  []Parameter           `json,yaml:"parameters"`
	Responses   map[string]Response   `json,yaml:"responses"`
	Definitions map[string]Definition `json,yaml:"definitions"`
}

type Parameter

type Parameter struct {
	Name             string         `json,yaml:"name"`
	In               string         `json,yaml:"in"`
	Description      string         `json,yaml:"description"`
	Required         bool           `json,yaml:"required"`
	Type             string         `json,yaml:"type"`
	CollectionFormat string         `json,yaml:"collectionFormat"`
	Items            map[string]any `json,yaml:"items"`
	Schema           SchemaObject   `json,yaml:"schema"`
}

func FilterParameters

func FilterParameters(params []Parameter, t string) []Parameter

type Response

type Response struct {
	Description string       `json,yaml:"description"`
	Schema      SchemaObject `json,yaml:"schema"`
}

type SchemaContext

type SchemaContext struct {
	TopRef      string
	Definitions map[string]Definition
	Definition  Definition
}

func CollectSchema

func CollectSchema(definitions map[string]Definition, schema string) SchemaContext

type SchemaObject

type SchemaObject struct {
	Type        string `json:"type"`
	Description string `json:"description"`
	Ref         string `json:"$ref"`
	Items       struct {
		Type string `json:"type"`
		Ref  string `json:"$ref"`
	} `json:"items"`
}

type Tag

type Tag struct {
	Tag      string
	BasePath string
	Methods  []*Operation
}

type Template

type Template struct {
	// contains filtered or unexported fields
}

func New

func New(templatePath, mode string) *Template

type Writer

type Writer interface {
	For(filename string) io.Writer
}

func NewWriter

func NewWriter(path string) Writer

Jump to

Keyboard shortcuts

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