openapi

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateInputSchema

func GenerateInputSchema(operation interface{}) (*jsonschema.Schema, error)

generateInputSchema creates a JSON schema for the tool input based on OpenAPI operation

func GetRequestBodyJSONContent

func GetRequestBodyJSONContent(requestBodyRef *openapi3.RequestBodyRef) (*openapi3.MediaType, error)

Types

type APISpec

type APISpec interface {
	GetVersion() string
	GetBaseURL() string
	GetPaths() map[string]PathItem
	GetInfo() openapi3.Info
}

APISpec represents either OpenAPI 2.0 or 3.0 specification

func LoadSpec

func LoadSpec(data []byte) (APISpec, error)

func LoadSpecFromSource added in v0.0.2

func LoadSpecFromSource(source string) (APISpec, error)

LoadSpecFromSource loads an OpenAPI spec from either a file path or URL

type OpenAPI2Operation

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

func (*OpenAPI2Operation) GetOperationID

func (o *OpenAPI2Operation) GetOperationID() string

func (*OpenAPI2Operation) GetParameters

func (o *OpenAPI2Operation) GetParameters() []Parameter

func (*OpenAPI2Operation) GetRequestBody

func (o *OpenAPI2Operation) GetRequestBody() RequestBody

func (*OpenAPI2Operation) GetSummary

func (o *OpenAPI2Operation) GetSummary() string

type OpenAPI2OperationWithPath

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

OpenAPI2OperationWithPath includes both operation and path-level parameters

func (*OpenAPI2OperationWithPath) GetOperationID

func (o *OpenAPI2OperationWithPath) GetOperationID() string

OpenAPI2OperationWithPath methods

func (*OpenAPI2OperationWithPath) GetParameters

func (o *OpenAPI2OperationWithPath) GetParameters() []Parameter

func (*OpenAPI2OperationWithPath) GetRequestBody

func (o *OpenAPI2OperationWithPath) GetRequestBody() RequestBody

func (*OpenAPI2OperationWithPath) GetSummary

func (o *OpenAPI2OperationWithPath) GetSummary() string

type OpenAPI2Parameter

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

func (*OpenAPI2Parameter) GetDescription

func (p *OpenAPI2Parameter) GetDescription() string

func (*OpenAPI2Parameter) GetFormat

func (p *OpenAPI2Parameter) GetFormat() string

func (*OpenAPI2Parameter) GetIn

func (p *OpenAPI2Parameter) GetIn() string

func (*OpenAPI2Parameter) GetName

func (p *OpenAPI2Parameter) GetName() string

func (*OpenAPI2Parameter) GetSchema

func (p *OpenAPI2Parameter) GetSchema() Schema

func (*OpenAPI2Parameter) GetType

func (p *OpenAPI2Parameter) GetType() string

func (*OpenAPI2Parameter) IsRequired

func (p *OpenAPI2Parameter) IsRequired() bool

type OpenAPI2PathItem

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

func (*OpenAPI2PathItem) GetOperations

func (p *OpenAPI2PathItem) GetOperations() map[string]Operation

type OpenAPI2RequestBody

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

func (*OpenAPI2RequestBody) GetJSONSchema

func (r *OpenAPI2RequestBody) GetJSONSchema() (Schema, error)

type OpenAPI2Schema

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

func (*OpenAPI2Schema) GetDefault

func (s *OpenAPI2Schema) GetDefault() interface{}

func (*OpenAPI2Schema) GetDescription

func (s *OpenAPI2Schema) GetDescription() string

func (*OpenAPI2Schema) GetEnum

func (s *OpenAPI2Schema) GetEnum() []interface{}

func (*OpenAPI2Schema) GetFormat

func (s *OpenAPI2Schema) GetFormat() string

func (*OpenAPI2Schema) GetItems

func (s *OpenAPI2Schema) GetItems() Schema

func (*OpenAPI2Schema) GetProperties

func (s *OpenAPI2Schema) GetProperties() map[string]Schema

func (*OpenAPI2Schema) GetRequired

func (s *OpenAPI2Schema) GetRequired() []string

func (*OpenAPI2Schema) GetType

func (s *OpenAPI2Schema) GetType() string

type OpenAPI2Spec

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

OpenAPI2Spec wraps openapi2.T

func (*OpenAPI2Spec) GetBaseURL

func (s *OpenAPI2Spec) GetBaseURL() string

func (*OpenAPI2Spec) GetInfo

func (s *OpenAPI2Spec) GetInfo() openapi3.Info

func (*OpenAPI2Spec) GetPaths

func (s *OpenAPI2Spec) GetPaths() map[string]PathItem

func (*OpenAPI2Spec) GetVersion

func (s *OpenAPI2Spec) GetVersion() string

type OpenAPI3Operation

type OpenAPI3Operation struct {
	Op *openapi3.Operation
}

Operation implementations

func (*OpenAPI3Operation) GetOperationID

func (o *OpenAPI3Operation) GetOperationID() string

func (*OpenAPI3Operation) GetParameters

func (o *OpenAPI3Operation) GetParameters() []Parameter

func (*OpenAPI3Operation) GetRequestBody

func (o *OpenAPI3Operation) GetRequestBody() RequestBody

func (*OpenAPI3Operation) GetSummary

func (o *OpenAPI3Operation) GetSummary() string

type OpenAPI3OperationWithPath

type OpenAPI3OperationWithPath struct {
	Op *openapi3.Operation
	// contains filtered or unexported fields
}

OpenAPI3OperationWithPath includes both operation and path-level parameters

func (*OpenAPI3OperationWithPath) GetOperationID

func (o *OpenAPI3OperationWithPath) GetOperationID() string

OpenAPI3OperationWithPath methods

func (*OpenAPI3OperationWithPath) GetParameters

func (o *OpenAPI3OperationWithPath) GetParameters() []Parameter

func (*OpenAPI3OperationWithPath) GetRequestBody

func (o *OpenAPI3OperationWithPath) GetRequestBody() RequestBody

func (*OpenAPI3OperationWithPath) GetSummary

func (o *OpenAPI3OperationWithPath) GetSummary() string

type OpenAPI3Parameter

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

Parameter implementations

func (*OpenAPI3Parameter) GetDescription

func (p *OpenAPI3Parameter) GetDescription() string

func (*OpenAPI3Parameter) GetFormat

func (p *OpenAPI3Parameter) GetFormat() string

func (*OpenAPI3Parameter) GetIn

func (p *OpenAPI3Parameter) GetIn() string

func (*OpenAPI3Parameter) GetName

func (p *OpenAPI3Parameter) GetName() string

func (*OpenAPI3Parameter) GetSchema

func (p *OpenAPI3Parameter) GetSchema() Schema

func (*OpenAPI3Parameter) GetType

func (p *OpenAPI3Parameter) GetType() string

func (*OpenAPI3Parameter) IsRequired

func (p *OpenAPI3Parameter) IsRequired() bool

type OpenAPI3PathItem

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

PathItem implementations

func (*OpenAPI3PathItem) GetOperations

func (p *OpenAPI3PathItem) GetOperations() map[string]Operation

type OpenAPI3RequestBody

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

func (*OpenAPI3RequestBody) GetJSONSchema

func (r *OpenAPI3RequestBody) GetJSONSchema() (Schema, error)

type OpenAPI3Schema

type OpenAPI3Schema struct {
	Schema *openapi3.Schema
}

func (*OpenAPI3Schema) GetDefault

func (s *OpenAPI3Schema) GetDefault() interface{}

func (*OpenAPI3Schema) GetDescription

func (s *OpenAPI3Schema) GetDescription() string

func (*OpenAPI3Schema) GetEnum

func (s *OpenAPI3Schema) GetEnum() []interface{}

func (*OpenAPI3Schema) GetFormat

func (s *OpenAPI3Schema) GetFormat() string

func (*OpenAPI3Schema) GetItems

func (s *OpenAPI3Schema) GetItems() Schema

func (*OpenAPI3Schema) GetProperties

func (s *OpenAPI3Schema) GetProperties() map[string]Schema

func (*OpenAPI3Schema) GetRequired

func (s *OpenAPI3Schema) GetRequired() []string

func (*OpenAPI3Schema) GetType

func (s *OpenAPI3Schema) GetType() string

type OpenAPI3Spec

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

OpenAPI3Spec wraps openapi3.T

func (*OpenAPI3Spec) GetBaseURL

func (s *OpenAPI3Spec) GetBaseURL() string

func (*OpenAPI3Spec) GetInfo

func (s *OpenAPI3Spec) GetInfo() openapi3.Info

func (*OpenAPI3Spec) GetPaths

func (s *OpenAPI3Spec) GetPaths() map[string]PathItem

func (*OpenAPI3Spec) GetVersion

func (s *OpenAPI3Spec) GetVersion() string

type Operation

type Operation interface {
	GetOperationID() string
	GetSummary() string
	GetParameters() []Parameter
	GetRequestBody() RequestBody
}

Operation represents an API operation

type Parameter

type Parameter interface {
	GetName() string
	GetIn() string
	GetDescription() string
	IsRequired() bool
	GetType() string
	GetFormat() string
	GetSchema() Schema
}

Parameter represents an API parameter

type PathItem

type PathItem interface {
	GetOperations() map[string]Operation
}

PathItem represents a path item that can contain operations

type RequestBody

type RequestBody interface {
	GetJSONSchema() (Schema, error)
}

RequestBody represents a request body

type Schema

type Schema interface {
	GetType() string
	GetFormat() string
	GetDescription() string
	GetProperties() map[string]Schema
	GetItems() Schema
	GetRequired() []string
	GetEnum() []interface{}
	GetDefault() interface{}
}

Schema represents a schema definition

Jump to

Keyboard shortcuts

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