openapi

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 3 Imported by: 0

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"`
}

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"`
}

func LoadFile

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

func (*Document) Operations

func (d *Document) Operations() []OperationView

type Info

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

type MediaType

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

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"`
}

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"`
	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 Schema

type Schema struct {
	Type                 string            `json:"type" yaml:"type"`
	Format               string            `json:"format" yaml:"format"`
	Description          string            `json:"description" yaml:"description"`
	Required             []string          `json:"required" yaml:"required"`
	Properties           map[string]Schema `json:"properties" yaml:"properties"`
	Items                *Schema           `json:"items" yaml:"items"`
	Enum                 []any             `json:"enum" yaml:"enum"`
	AdditionalProperties any               `json:"additionalProperties" yaml:"additionalProperties"`
}

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"`
}

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