schema

package
v0.0.0-...-c71d033 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSchema

func BuildSchema(comments in.SwagifyComment, schemas map[string]Schema)

func BuildSchemaStruct

func BuildSchemaStruct(myStructs []in.MyStruct) map[string]Schema

Types

type AdditionalProperty

type AdditionalProperty struct {
	Type  string            `json:"type,omitempty" yaml:"type,omitempty"`
	Items map[string]string `json:"items,omitempty" yaml:"items,omitempty"`
}

type Schema

type Schema struct {
	Type           string                    `json:"type,omitempty" yaml:"type,omitempty"`
	Required       []string                  `json:"required,omitempty" yaml:"required,omitempty"`
	Description    string                    `json:"description,omitempty" yaml:"description,omitempty"`
	Example        string                    `json:"example,omitempty" yaml:"example,omitempty"`
	Properties     map[string]SchemaProperty `json:"properties,omitempty" yaml:"properties,omitempty"`
	AddlProperties AdditionalProperty        `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
	Items          map[string]string         `json:"items,omitempty" yaml:"items,omitempty"`
}

type SchemaProperty

type SchemaProperty struct {
	Ref         string      `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Type        string      `json:"type,omitempty" yaml:"type,omitempty"`
	Description string      `json:"description,omitempty" yaml:"description,omitempty"`
	Example     interface{} `json:"example,omitempty" yaml:"example,omitempty"`
	ExampleStr  string      `json:"-" yaml:"-"`
	Enum        []string    `json:"enum,omitempty" yaml:"enum,omitempty"`
}

TODO: if type is object or array may need to have self reference

Jump to

Keyboard shortcuts

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