openapi

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeFromYaml

func DeserializeFromYaml(file []byte) (map[string]any, error)

Types

type BuildParameter

type BuildParameter struct {
	Value    string
	Children *map[string]BuildParameter
	Vector   bool
	Binary   bool
}

type Components

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

type Contact

type Contact struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type FactoryCollection

type FactoryCollection struct {
	// contains filtered or unexported fields
}

func NewFactoryCollection

func NewFactoryCollection(owner string, openapi *OpenAPI) *FactoryCollection

func (*FactoryCollection) Make

func (*FactoryCollection) MakeFromOperation

func (b *FactoryCollection) MakeFromOperation(method domain.HttpMethod, path string, operation *Operation, ctx *context.Context) (*context.Context, *action.Request)

func (*FactoryCollection) MakeFromParameters

func (b *FactoryCollection) MakeFromParameters(path string, parameters []Parameter, ctx *context.Context) (string, *context.Context, *query.Queries, *header.Headers, *cookie.CookiesClient)

func (*FactoryCollection) MakeFromRequestBody

func (b *FactoryCollection) MakeFromRequestBody(requestBody *RequestBody) *body.BodyRequest

func (*FactoryCollection) MakeFromSchema

func (b *FactoryCollection) MakeFromSchema(content string, schema *Schema, visited map[string]int) (map[string]BuildParameter, map[string]int)

func (*FactoryCollection) MakeFromSecurity

func (b *FactoryCollection) MakeFromSecurity(security []SecurityRequirement, queries *header.Headers) *auth.Auths

func (*FactoryCollection) SetRaw

func (b *FactoryCollection) SetRaw(raw map[string]any) *FactoryCollection

type Info

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

type MediaType

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

type OpenAPI

type OpenAPI struct {
	OpenAPI    string                `json:"openapi"`
	Info       Info                  `json:"info"`
	Servers    []Server              `json:"servers"`
	Paths      map[string]PathItem   `json:"paths"`
	Components Components            `json:"components"`
	Security   []SecurityRequirement `json:"security"`
	Tags       []Tag                 `json:"tags"`
}

func MakeFromJson

func MakeFromJson(file []byte) (*OpenAPI, *map[string]any, error)

func MakeFromYaml

func MakeFromYaml(file []byte) (*OpenAPI, *map[string]any, error)

type Operation

type Operation struct {
	Tags        []string              `json:"tags"`
	Summary     string                `json:"summary"`
	Description string                `json:"description"`
	Parameters  []Parameter           `json:"parameters,omitempty"`
	RequestBody *RequestBody          `json:"requestBody,omitempty"`
	Responses   map[string]Response   `json:"responses"`
	Security    []SecurityRequirement `json:"security,omitempty"`
}

type Parameter

type Parameter struct {
	Name        string `json:"name"`
	In          string `json:"in"`
	Required    bool   `json:"required"`
	Description string `json:"description"`
	Schema      Schema `json:"schema"`
}

type PathItem

type PathItem struct {
	Get    *Operation `json:"get,omitempty"`
	Post   *Operation `json:"post,omitempty"`
	Put    *Operation `json:"put,omitempty"`
	Delete *Operation `json:"delete,omitempty"`
}

type RequestBody

type RequestBody struct {
	Required bool                 `json:"required"`
	Content  map[string]MediaType `json:"content"`
	Ref      string               `json:"$ref,omitempty"`
}

type Response

type Response struct {
	Description string               `json:"description"`
	Content     map[string]MediaType `json:"content,omitempty"`
}

type Schema

type Schema struct {
	Ref        string            `json:"$ref,omitempty"`
	Type       string            `json:"type"`
	Format     string            `json:"format"`
	Properties map[string]Schema `json:"properties,omitempty"`
	Items      *Schema           `json:"items,omitempty"`
	Example    any               `json:"example,omitempty"`
}

type SecurityRequirement

type SecurityRequirement map[string][]string

type SecurityScheme

type SecurityScheme struct {
	Type         string `json:"type"`
	In           string `json:"in"`
	Name         string `json:"name"`
	Scheme       string `json:"scheme,omitempty"`
	BearerFormat string `json:"bearerFormat,omitempty"`
}

type Server

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

type Tag

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