markdown

package
v0.0.0-...-6a89294 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExcludeTags = []string{}
)

Functions

func FilterSchema

func FilterSchema(schema string) string

func FormatAnchor

func FormatAnchor(schema string) string

func FormatMarkdown

func FormatMarkdown(src []byte, opt *markdown.Options) ([]byte, error)

Process formats Markdown. If opt is nil the defaults are used. Error can only occur when reading input from filename rather than src.

func FormatMarkdownFile

func FormatMarkdownFile(filename string) error

func FormatPath

func FormatPath(schema string) string

func IsExcludeTag

func IsExcludeTag(tags []string) bool

func RenderFromJSON

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

func RenderFromYAML

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

func StringContains

func StringContains(s []string, e string) bool

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]Operations   `json,yaml:"paths"`
	Definitions map[string]SchemaObject `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 ExternalDocumentation

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

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 Method

type Method struct {
	Index int
	*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]SchemaObject `json,yaml:"definitions"`
}

type Operations

type Operations map[string]*Operation

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]interface{} `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]SchemaObject
	Definition  SchemaObject
}

func CollectSchema

func CollectSchema(definitions map[string]SchemaObject, schema interface{}) SchemaContext

type SchemaObject

type SchemaObject struct {
	Type        string                  `json:"type"`
	Example     string                  `json,yaml:"example"`
	Properties  map[string]SchemaObject `json:"properties"`
	Description string                  `json:"description"`
	Ref         string                  `json:"$ref"`
	Items       struct {
		Type string `json:"type"`
		Ref  string `json:"$ref"`
	} `json:"items"`
	ExternalDocs ExternalDocumentation `json,yaml:"external_docs"`
}

func (*SchemaObject) UnmarshalJSON

func (u *SchemaObject) UnmarshalJSON(data []byte) error

type Tag

type Tag struct {
	TagIndex int
	Tag      string
	BasePath string
	Methods  map[int]*Method
}

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