openapi

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultServiceFromSource

func DefaultServiceFromSource(source string) string

func ResolveServiceName

func ResolveServiceName(serviceOverride, title, sourceHint string) (string, error)

Types

type APISpec

type APISpec struct {
	Title   string     `json:"title"`
	Version string     `json:"version"`
	Paths   []PathItem `json:"paths"`
}

type GETOperation

type GETOperation struct {
	Path        string
	OperationID string
	Parameters  []Parameter
}

type ItemSpec added in v0.9.0

type ItemSpec struct {
	Type string `json:"type"`
	Enum []any  `json:"enum,omitempty"`
}

type Loader

type Loader interface {
	Load(ctx context.Context, ref string) (APISpec, error)
}

type NestedSpec

type NestedSpec struct {
	Title   string    `json:"title"`
	Version string    `json:"version"`
	Paths   *PathNode `json:"paths"`
}

func BuildNestedSpec

func BuildNestedSpec(api APISpec) (*NestedSpec, error)

type Operation

type Operation struct {
	OperationID string      `json:"operationId"`
	Parameters  []Parameter `json:"parameters,omitempty"`
}

type OperationSpec

type OperationSpec struct {
	ID           string          `json:"id"`
	PathTemplate string          `json:"pathTemplate"`
	PathFormat   string          `json:"pathFormat"`
	PathArgNames []string        `json:"pathArgNames"`
	QueryParams  []ParameterSpec `json:"queryParams"`
	HeaderParams []ParameterSpec `json:"headerParams"`
}

type Parameter

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

type ParameterSpec

type ParameterSpec struct {
	Name     string    `json:"name"`
	Required bool      `json:"required"`
	Type     string    `json:"type"`
	Items    *ItemSpec `json:"items,omitempty"`
	Enum     []any     `json:"enum,omitempty"`
}

type Parser

type Parser interface {
	Parse(ctx context.Context, spec string) (APISpec, error)
}

type PathItem

type PathItem struct {
	Path       string      `json:"path"`
	Parameters []Parameter `json:"parameters,omitempty"`
	Get        *Operation  `json:"get,omitempty"`
}

type PathNode

type PathNode struct {
	Operation *OperationSpec       `json:"operation,omitempty"`
	Children  map[string]*PathNode `json:"children,omitempty"`
}

type Schema added in v0.9.0

type Schema struct {
	Type  string  `json:"type,omitempty"`
	Enum  []any   `json:"enum,omitempty"`
	Items *Schema `json:"items,omitempty"`
}

Jump to

Keyboard shortcuts

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