openapi

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaTypeRangeAny    mediaType = "*/*"
	MediaTypeJson        mediaType = "application/json"
	MediaTypeTextPlain   mediaType = "text/plain"
	MediaTypeOctetStream mediaType = "application/octet-stream" // TODO: discuss
)

JSIght 0.3 supports: "json", "plainString", "binary"

View Source
const (
	ParameterLocationPath   parameterLocation = "path"
	ParameterLocationQuery  parameterLocation = "query"
	ParameterLocationHeader parameterLocation = "header"
	ParameterLocationCookie parameterLocation = "cookie"
)
View Source
const (
	ParameterStyleMatrix     parameterStyle = "matrix"
	ParameterStyleLabel      parameterStyle = "label"
	ParameterStyleForm       parameterStyle = "form"
	ParameterStyleSimple     parameterStyle = "simple"
	ParameterStyleDeepObject parameterStyle = "deepObject"
)

Variables

This section is empty.

Functions

func NewOpenAPI

func NewOpenAPI(c *catalog.Catalog) (oa *OpenAPI, err Error)

Types

type Components

type Components struct {
	Schemas ComponentsSchemas `json:"schemas,omitempty"`
}

type ComponentsSchemas

type ComponentsSchemas map[string]schemaObject

type Content

type Content map[mediaType]*MediaTypeObject

Content is used in Responses and Requests

type Error

type Error interface {
	error
	// contains filtered or unexported methods
}

type HeaderObject

type HeaderObject struct {
	ParameterBase
}

type Info

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

type MediaTypeObject

type MediaTypeObject struct {
	Schema schemaObject `json:"schema,omitempty"` // TODO: empty?
}

Other properties of OA MediaTypeObject are not used in JSigh

type OpenAPI

type OpenAPI struct {
	OpenAPI    string      `json:"openapi"`
	Info       *Info       `json:"info"`
	Servers    []Server    `json:"servers,omitempty"`
	Paths      Paths       `json:"paths"`
	Components *Components `json:"components,omitempty"`
	// contains filtered or unexported fields
}

type Operation

type Operation struct {
	Summary     string             `json:"summary,omitempty"`
	Description string             `json:"description,omitempty"`
	Parameters  []*ParameterObject `json:"parameters,omitempty"`
	RequestBody *RequestBody       `json:"requestBody,omitempty"`
	Responses   *Responses         `json:"responses"`
	Tags        []string           `json:"tags,omitempty"`
	OperationId *string            `json:"operationId,omitempty"`
}

type ParameterBase

type ParameterBase struct {
	Description string         `json:"description,omitempty"`
	Required    bool           `json:"required,omitempty"`
	Style       parameterStyle `json:"style,omitempty"`
	Explode     bool           `json:"explode,omitempty"`
	Schema      schemaObject   `json:"schema"`
}

Common fields for HeaderObject and ParameterObject In OAS Header Object is officially a subset of Parameter Object

type ParameterObject

type ParameterObject struct {
	ParameterBase
	Name string            `json:"name"`
	In   parameterLocation `json:"in"`
}

type PathItem

type PathItem struct {
	Parameters []*ParameterObject `json:"parameters,omitempty"`
	Get        *Operation         `json:"get,omitempty"`
	Put        *Operation         `json:"put,omitempty"`
	Post       *Operation         `json:"post,omitempty"`
	Patch      *Operation         `json:"patch,omitempty"`
	Delete     *Operation         `json:"delete,omitempty"`
}

type Paths

type Paths map[string]*PathItem

type RequestBody

type RequestBody struct {
	Content  *Content `json:"content"`
	Required bool     `json:"required,omitempty"`
}

type ResponseHeaders

type ResponseHeaders map[string]*HeaderObject

Only for Response objects. For request headers refer to "parameters"

type ResponseObject

type ResponseObject struct {
	Description string          `json:"description"`
	Headers     ResponseHeaders `json:"headers,omitempty"`
	Content     *Content        `json:"content,omitempty"`
}

type Responses

type Responses map[responseCode]*ResponseObject

type Server

type Server struct {
	Url         string `json:"url"`
	Description string `json:"description,omitempty"` // def "", md support
}

Jump to

Keyboard shortcuts

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