openapi

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 12 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

View Source
const (
	RespRefBadRequest          = "#/components/responses/BadRequest"
	RespRefFound               = "#/components/responses/Found"
	RespRefInternalServerError = "#/components/responses/InternalServerError"
	RespRefNotFound            = "#/components/responses/NotFound"
	RespRefSeeOther            = "#/components/responses/SeeOther"
	RespRefUnauthorized        = "#/components/responses/Unauthorized"
)

Component references for the shared responses declared once in the generated document and pointed at from every operation that can return them. They are named because they are INTERNAL cross-references: a typo produces a document that still serializes and still validates as JSON, but whose $ref resolves to nothing -- a failure that surfaces in a client generator long after the change that caused it. The most-used of them appears at 25 call sites.

Variables

This section is empty.

Functions

func ArrayQueryParam

func ArrayQueryParam(name string, description string) *openapi.ParameterRef

func ExtractParameters

func ExtractParameters(routePath string, query string, header http.Header) openapi.Parameters

func ExtractSchemaName

func ExtractSchemaName(schemaString string) (string, error)

func GenerateNameFromPath

func GenerateNameFromPath(routePath string, headerValue string) string

func GenerateOperationID

func GenerateOperationID(name string, method string, headerValue string) string

func Host

func Host(r *http.Request) string

func InferSchema

func InferSchema(val any) *openapi.SchemaRef

func MergeOperations

func MergeOperations(dest, src *OpenAPI)

func PathParam

func PathParam(name string, description string) *openapi.ParameterRef

func QueryParam

func QueryParam(name string, description string) *openapi.ParameterRef

func WildcardPathParam

func WildcardPathParam(name string, description string) *openapi.ParameterRef

Types

type Builder

type Builder struct {
	Contact         *openapi.Contact
	License         *openapi.License
	Security        *openapi.SecurityRequirements
	SecuritySchemes *openapi.SecuritySchemes
	TypesToInclude  []PathType
}

func (*Builder) BuildOneOff

func (b *Builder) BuildOneOff(serverUrl string, fn *kdexv1alpha1.KDexFunction) *openapi.T

func (*Builder) BuildOpenAPI

func (b *Builder) BuildOpenAPI(
	serverUrl string,
	name string,
	paths map[string]PathInfo,
	filter Filter,
) *openapi.T

type Filter

type Filter struct {
	Paths []string
	Tags  []string
	Type  []PathType
}

type OpenAPI

type OpenAPI struct {
	BasePath string
	Paths    map[string]PathItem
	Schemas  map[string]*openapi.SchemaRef
}

func FromKDexAPI

func FromKDexAPI(k *kdexv1alpha1.API) *OpenAPI

func (*OpenAPI) ToKDexAPI

func (o *OpenAPI) ToKDexAPI() *kdexv1alpha1.API

type PathInfo

type PathInfo struct {
	API           OpenAPI
	AutoGenerated bool
	Metadata      kdexv1alpha1.Metadata
	Type          PathType
}

type PathItem

type PathItem struct {
	Connect     *openapi.Operation
	Delete      *openapi.Operation
	Description string
	Get         *openapi.Operation
	Head        *openapi.Operation
	Options     *openapi.Operation
	Parameters  []openapi.Parameter
	Patch       *openapi.Operation
	Post        *openapi.Operation
	Put         *openapi.Operation
	Summary     string
	Trace       *openapi.Operation
}

func (*PathItem) SetOperation

func (o *PathItem) SetOperation(method string, op *openapi.Operation)

type PathType

type PathType string
const (
	BackendPathType  PathType = "BACKEND"
	FunctionPathType PathType = "FUNCTION"
	PagePathType     PathType = "PAGE"
	SystemPathType   PathType = "SYSTEM"
)

Jump to

Keyboard shortcuts

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