taxonomy

package
v1.18.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const XTaxonomy = "x-taxonomy"

Variables

View Source
var ErrCategoryNotFound = errors.New("category not found")

Functions

This section is empty.

Types

type Categories

type Categories []Category

func (*Categories) Category

func (cats *Categories) Category(title string) (Category, error)

func (*Categories) MapSlice

func (cats *Categories) MapSlice() mapslice.MapSlice

func (*Categories) MarshalJSON

func (cats *Categories) MarshalJSON(prefix, indent string) ([]byte, error)

func (*Categories) MarshalYAML

func (cats *Categories) MarshalYAML() ([]byte, error)

func (*Categories) SpecAddXTaxonomy

func (cats *Categories) SpecAddXTaxonomy(spec *openapi3.Spec, catTitle, catsFilepath string) error

SpecAddXTaxonomy expects `catTitle` to be the same as the OAS3 `tag` name.

func (*Categories) WriteFileJSON

func (cats *Categories) WriteFileJSON(filename string, perm os.FileMode, prefix, indent string) error

func (*Categories) WriteFileYAML

func (cats *Categories) WriteFileYAML(filename string, perm os.FileMode) error

type Category

type Category struct {
	Key         string     `json:"-"`
	Slug        string     `json:"slug,omitempty"`
	Title       string     `json:"title,omitempty"`
	Description string     `json:"description,omitempty"`
	Tags        []oas3.Tag `json:"tags,omitempty" yaml:"tags,omitempty"`
}

func (*Category) Taxonomy

func (cat *Category) Taxonomy(catsFilepath string) (Taxonomy, error)

type CategoryRef

type CategoryRef struct {
	Ref string `json:"$ref"`
}

type Taxonomy

type Taxonomy struct {
	Category CategoryRef `json:"category"`
	Slug     string      `json:"slug"`
}

func (*Taxonomy) AddToSpec

func (tax *Taxonomy) AddToSpec(spec *openapi3.Spec)

Jump to

Keyboard shortcuts

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