openapi

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Summary     string               `yaml:"summary" json:"summary"`
	Description string               `yaml:"description" json:"description"`
	RequestBody *RequestBody         `yaml:"requestBody" json:"requestBody,omitempty"`
	Parameters  Parameters           `yaml:"parameters" json:"parameters"`
	Tags        []string             `yaml:"tags" json:"tags,omitempty"`
	Responses   map[string]*Response `yaml:"responses" json:"responses"`
	OperationID string               `json:"operationId,omitempty"`
}

type Extension

type Extension struct {
	Base   string            `json:"base"`
	Fields []*ExtensionField `json:"fields"`
}

type ExtensionField

type ExtensionField struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Number int    `json:"number"`
}

type Info

type Info struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Version     string `json:"version"`
}

type Model

type Model struct {
	Properties map[string]*Schema `json:"properties"`
	Name       string
	Depth      int
}

type Parameter

type Parameter struct {
	Name        string      `json:"name,omitempty"`
	Description string      `json:"description"`
	Enum        []string    `json:"enum,omitempty"`
	Format      string      `json:"format,omitempty"`
	In          string      `json:"in,omitempty"`
	Items       *Schema     `json:"items,omitempty"`
	Ref         string      `json:"$ref,omitempty"`
	Required    bool        `json:"required"`
	Schema      *Schema     `json:"schema,omitempty"`
	Type        string      `json:"type,omitempty"`
	Example     interface{} `json:"example,omitempty"`
}

type Parameters

type Parameters []*Parameter

type Path

type Path struct {
	Get        *Endpoint  `json:"get,omitempty"`
	Put        *Endpoint  `json:"put,omitempty"`
	Post       *Endpoint  `json:"post,omitempty"`
	Patch      *Endpoint  `json:"patch,omitempty"`
	Delete     *Endpoint  `json:"delete,omitempty"`
	Parameters Parameters `json:"parameters,omitempty"`
}

type RequestBody added in v0.6.3

type RequestBody struct {
	Description string             `yaml:"summary" json:"description"`
	Required    bool               `yaml:"summary" json:"required"`
	Content     RequestBodyContent `yaml:"summary" json:"content"`
}

type RequestBodyContent added in v0.6.3

type RequestBodyContent struct {
	Json *RequestBodyContentType `yaml:"application/json" json:"application/json,omitempty"`
	XML  *RequestBodyContentType `yaml:"application/xml" json:"application/xml,omitempty"`
	Form *RequestBodyContentType `yaml:"application/x-www-form-urlencoded" json:"application/x-www-form-urlencoded,omitempty"`
	Text *RequestBodyContentType `yaml:"text/plain" json:"text/plain,omitempty"`
}

type RequestBodyContentType added in v0.6.3

type RequestBodyContentType struct {
	Schema   Schema      `yaml:"schema" json:"schema"`
	Examples interface{} `yaml:"examples" json:"examples,omitempty"`
}

type Response

type Response struct {
	Description string  `json:"description"`
	Schema      *Schema `json:"schema,omitempty"`
}

type Schema

type Schema struct {
	Description string `json:"description,omitempty"`

	Ref    string   `json:"$ref,omitempty"`
	Type   string   `json:"type,omitempty"`
	Format string   `json:"format,omitempty"`
	Enum   []string `json:"enum,omitempty"`

	// objects
	Required   []string           `json:"required,omitempty"`
	Properties map[string]*Schema `json:"properties,omitempty"`

	// is an array
	Items *Schema `json:"items,omitempty"`

	Pattern   string      `json:"pattern,omitempty"`
	MaxLength int         `json:"maxLength,omitempty"`
	MinLength int         `json:"minLength,omitempty"`
	Maximum   int         `json:"maximum,omitempty"`
	Minimum   int         `json:"minimum,omitempty"`
	Example   interface{} `json:"example,omitempty"`

	// only for the different Doc when it's Ref object
	AllOf []*Schema `json:"allOf,omitempty"`
}

type Spec

type Spec struct {
	Swagger       string                `json:"swagger"`
	Info          Info                  `json:"info"`
	Host          string                `json:"host,omitempty"`
	Schemes       []string              `json:"schemes,omitempty"`
	BasePath      string                `json:"basePath,omitempty"`
	Tags          []Tag                 `json:"tags,omitempty"`
	Produces      []string              `json:"produces,omitempty"`
	Paths         map[string]*Path      `json:"paths,omitempty"`
	Definitions   map[string]*Schema    `json:"definitions,omitempty"`
	Parameters    map[string]*Parameter `json:"parameters,omitempty"`
	Extensions    []*Extension          `json:"x-extensions,omitempty"`
	GlobalOptions map[string]string     `json:"x-global-options,omitempty"`
}

type Tag added in v0.4.0

type Tag struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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