openapi

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Components added in v0.1.1

type Components struct {
	SecuritySchemes map[string]SecurityScheme `json:"securitySchemes" yaml:"securitySchemes"`
	Schemas         map[string]Schema         `json:"schemas" yaml:"schemas"`
}

type Document

type Document struct {
	OpenAPI     string                `json:"openapi" yaml:"openapi"`
	Info        Info                  `json:"info" yaml:"info"`
	Servers     []Server              `json:"servers" yaml:"servers"`
	Paths       map[string]PathItem   `json:"paths" yaml:"paths"`
	Components  Components            `json:"components" yaml:"components"`
	Security    []SecurityRequirement `json:"security" yaml:"security"`
	SecuritySet bool                  `json:"-" yaml:"-"`
}

func LoadFile

func LoadFile(path string) (*Document, error)

func LoadFileWithOptions added in v0.11.0

func LoadFileWithOptions(path string, options LoadOptions) (*Document, error)

LoadFileWithOptions loads an OpenAPI document with an explicit reference policy.

func (*Document) Operations

func (d *Document) Operations() []OperationView
type Header struct {
	Description string `json:"description" yaml:"description"`
	Required    bool   `json:"required" yaml:"required"`
	Schema      Schema `json:"schema" yaml:"schema"`
}

type Info

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

type LoadOptions added in v0.11.0

type LoadOptions struct {
	ExternalRefRoot   string
	RemoteRefHosts    []string
	HTTPClient        *http.Client
	MaxReferenceBytes int64
}

LoadOptions controls how OpenAPI external references are resolved. Local references are restricted to ExternalRefRoot; remote references must match one of RemoteRefHosts.

type MediaType

type MediaType struct {
	Schema Schema `json:"schema" yaml:"schema"`
}

type OAuth2Flow added in v0.10.0

type OAuth2Flow struct {
	AuthorizationURL string            `json:"authorizationUrl" yaml:"authorizationUrl"`
	TokenURL         string            `json:"tokenUrl" yaml:"tokenUrl"`
	RefreshURL       string            `json:"refreshUrl" yaml:"refreshUrl"`
	Scopes           map[string]string `json:"scopes" yaml:"scopes"`
}

type Operation

type Operation struct {
	OperationID string                `json:"operationId" yaml:"operationId"`
	Summary     string                `json:"summary" yaml:"summary"`
	Description string                `json:"description" yaml:"description"`
	Parameters  []Parameter           `json:"parameters" yaml:"parameters"`
	RequestBody *RequestBody          `json:"requestBody" yaml:"requestBody"`
	Responses   map[string]Response   `json:"responses" yaml:"responses"`
	Security    []SecurityRequirement `json:"security" yaml:"security"`
	SecuritySet bool                  `json:"-" yaml:"-"`
}

type OperationView

type OperationView struct {
	Path       string
	Method     string
	Item       PathItem
	Op         *Operation
	Parameters []Parameter
}

type Parameter

type Parameter struct {
	Name          string `json:"name" yaml:"name"`
	In            string `json:"in" yaml:"in"`
	Required      bool   `json:"required" yaml:"required"`
	Style         string `json:"style" yaml:"style"`
	Explode       *bool  `json:"explode" yaml:"explode"`
	AllowReserved bool   `json:"allowReserved" yaml:"allowReserved"`
	Schema        Schema `json:"schema" yaml:"schema"`
}

type PathItem

type PathItem struct {
	Summary     string      `json:"summary" yaml:"summary"`
	Description string      `json:"description" yaml:"description"`
	Parameters  []Parameter `json:"parameters" yaml:"parameters"`
	Get         *Operation  `json:"get" yaml:"get"`
	Post        *Operation  `json:"post" yaml:"post"`
	Put         *Operation  `json:"put" yaml:"put"`
	Patch       *Operation  `json:"patch" yaml:"patch"`
	Delete      *Operation  `json:"delete" yaml:"delete"`
}

type RequestBody

type RequestBody struct {
	Required bool                 `json:"required" yaml:"required"`
	Content  map[string]MediaType `json:"content" yaml:"content"`
}

type Response added in v0.12.0

type Response struct {
	Description string               `json:"description" yaml:"description"`
	Headers     map[string]Header    `json:"headers" yaml:"headers"`
	Content     map[string]MediaType `json:"content" yaml:"content"`
}

type Schema

type Schema struct {
	Ref                  string            `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Type                 string            `json:"type" yaml:"type"`
	Types                []string          `json:"types,omitempty" yaml:"types,omitempty"`
	Format               string            `json:"format" yaml:"format"`
	Description          string            `json:"description" yaml:"description"`
	Nullable             bool              `json:"nullable,omitempty" yaml:"nullable,omitempty"`
	Default              any               `json:"default,omitempty" yaml:"default,omitempty"`
	Minimum              *float64          `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	Maximum              *float64          `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	ExclusiveMinimum     *float64          `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
	ExclusiveMaximum     *float64          `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
	MultipleOf           *float64          `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
	MinLength            uint64            `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	MaxLength            *uint64           `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	Pattern              string            `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	MinItems             uint64            `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	MaxItems             *uint64           `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	UniqueItems          bool              `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	MinProperties        uint64            `json:"minProperties,omitempty" yaml:"minProperties,omitempty"`
	MaxProperties        *uint64           `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"`
	Required             []string          `json:"required" yaml:"required"`
	Properties           map[string]Schema `json:"properties" yaml:"properties"`
	Items                *Schema           `json:"items" yaml:"items"`
	OneOf                []Schema          `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
	AnyOf                []Schema          `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`
	AllOf                []Schema          `json:"allOf,omitempty" yaml:"allOf,omitempty"`
	Enum                 []any             `json:"enum" yaml:"enum"`
	AdditionalProperties any               `json:"additionalProperties" yaml:"additionalProperties"`
}

type SecurityRequirement added in v0.4.0

type SecurityRequirement map[string][]string

type SecurityScheme added in v0.1.1

type SecurityScheme struct {
	Type         string                `json:"type" yaml:"type"`
	Name         string                `json:"name" yaml:"name"`
	In           string                `json:"in" yaml:"in"`
	Scheme       string                `json:"scheme" yaml:"scheme"`
	BearerFormat string                `json:"bearerFormat" yaml:"bearerFormat"`
	Flows        map[string]OAuth2Flow `json:"flows" yaml:"flows"`
}

type Server

type Server struct {
	URL string `json:"url" yaml:"url"`
}

Jump to

Keyboard shortcuts

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