openapi

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSchemas

func GetSchemas(schema *OpenAPISchema) map[string]SchemaProperty

Types

type Config added in v0.2.21

type Config struct {
	XConfig ConfigSchema `yaml:"x-config"`
}

type ConfigSchema

type ConfigSchema struct {
	Sections []map[string]Section `yaml:"sections"`
}

type EndpointSchema

type EndpointSchema struct {
	Name     string `yaml:"name"`
	Method   string `yaml:"method"`
	Endpoint string `yaml:"endpoint"`
}

type ExtraHeader

type ExtraHeader struct {
	Values []string
}

ExtraHeader can be either string or []string

func (*ExtraHeader) UnmarshalYAML

func (h *ExtraHeader) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements custom unmarshaling for ExtraHeader

type ModelMap

type ModelMap struct {
	Source    string         `yaml:"source,omitempty"`
	Transform []TransformRef `yaml:"transform"`
}

type OpenAPISchema

type OpenAPISchema struct {
	Components struct {
		Schemas struct {
			Config   Config   `yaml:"Config"`
			Provider Provider `yaml:"Provider"`

			ProviderAuthType                      SchemaProperty `yaml:"ProviderAuthType"`
			MessageRole                           SchemaProperty `yaml:"MessageRole"`
			Message                               SchemaProperty `yaml:"Message"`
			Model                                 SchemaProperty `yaml:"Model"`
			ListModelsResponse                    SchemaProperty `yaml:"ListModelsResponse"`
			Endpoints                             SchemaProperty `yaml:"Endpoints"`
			Error                                 SchemaProperty `yaml:"Error"`
			FunctionObject                        SchemaProperty `yaml:"FunctionObject"`
			FunctionParameters                    SchemaProperty `yaml:"FunctionParameters"`
			FinishReason                          SchemaProperty `yaml:"FinishReason"`
			CompletionUsage                       SchemaProperty `yaml:"CompletionUsage"`
			ChatCompletionToolType                SchemaProperty `yaml:"ChatCompletionToolType"`
			ChatCompletionTool                    SchemaProperty `yaml:"ChatCompletionTool"`
			ChatCompletionChoice                  SchemaProperty `yaml:"ChatCompletionChoice"`
			ChatCompletionStreamChoice            SchemaProperty `yaml:"ChatCompletionStreamChoice"`
			CreateChatCompletionRequest           SchemaProperty `yaml:"CreateChatCompletionRequest"`
			CreateCompletionRequest               SchemaProperty `yaml:"CreateCompletionRequest"`
			CreateChatCompletionResponse          SchemaProperty `yaml:"CreateChatCompletionResponse"`
			ChatCompletionStreamOptions           SchemaProperty `yaml:"ChatCompletionStreamOptions"`
			CreateChatCompletionStreamResponse    SchemaProperty `yaml:"CreateChatCompletionStreamResponse"`
			ChatCompletionStreamResponseDelta     SchemaProperty `yaml:"ChatCompletionStreamResponseDelta"`
			ChatCompletionMessageToolCallChunk    SchemaProperty `yaml:"ChatCompletionMessageToolCallChunk"`
			ChatCompletionMessageToolCall         SchemaProperty `yaml:"ChatCompletionMessageToolCall"`
			ChatCompletionMessageToolCallFunction SchemaProperty `yaml:"ChatCompletionMessageToolCallFunction"`
			ListToolsResponse                     SchemaProperty `yaml:"ListToolsResponse"`
			MCPTool                               SchemaProperty `yaml:"MCPTool"`
			MCPNotExposed                         SchemaProperty `yaml:"MCPNotExposed"`
			ListAgentsResponse                    SchemaProperty `yaml:"ListAgentsResponse"`
			A2ANotExposed                         SchemaProperty `yaml:"A2ANotExposed"`
			A2AAgentCard                          SchemaProperty `yaml:"A2AAgentCard"`
		}
	}
}

OpenAPI schema structures

func Read

func Read(openapi string) (*OpenAPISchema, error)

type Property

type Property struct {
	Name                 string              `yaml:"name,omitempty"`
	Type                 string              `yaml:"type"`
	Format               string              `yaml:"format,omitempty"`
	Description          string              `yaml:"description,omitempty"`
	Ref                  string              `yaml:"$ref,omitempty"`
	Enum                 []string            `yaml:"enum,omitempty"`
	Properties           map[string]Property `yaml:"properties,omitempty"`
	Items                *Property           `yaml:"items,omitempty"`
	AdditionalProperties *bool               `yaml:"additionalProperties,omitempty"`
}

type Provider added in v0.2.22

type Provider struct {
	XProviderConfigs map[string]ProviderConfig `yaml:"x-provider-configs"`
}

type ProviderConfig

type ProviderConfig struct {
	ID           string                    `yaml:"id"`
	URL          string                    `yaml:"url"`
	AuthType     string                    `yaml:"auth_type"`
	ExtraHeaders map[string]ExtraHeader    `yaml:"extra_headers"`
	Endpoints    map[string]EndpointSchema `yaml:"endpoints"`
}

type SchemaField

type SchemaField struct {
	Type       string                 `yaml:"type"`
	Properties map[string]SchemaField `yaml:"properties"`
	Items      *SchemaField           `yaml:"items"`
	Ref        string                 `yaml:"$ref"`
}

type SchemaProperty

type SchemaProperty struct {
	Type                 string              `yaml:"type"`
	Description          string              `yaml:"description"`
	Properties           map[string]Property `yaml:"properties"`
	Required             []string            `yaml:"required,omitempty"`
	Items                *Property           `yaml:"items,omitempty"`
	Enum                 []string            `yaml:"enum,omitempty"`
	AdditionalProperties *bool               `yaml:"additionalProperties,omitempty"`
}

type Section

type Section struct {
	Title    string    `yaml:"title"`
	Settings []Setting `yaml:"settings"`
}

type Setting added in v0.1.10

type Setting struct {
	Env         string `yaml:"env"`
	Type        string `yaml:"type"`
	Default     string `yaml:"default,omitempty"`
	Description string `yaml:"description"`
	Secret      bool   `yaml:"secret,omitempty"`
}

type Transform

type Transform struct {
	Target  string       `yaml:"target"`
	Mapping TransformMap `yaml:"mapping"`
}

type TransformMap

type TransformMap struct {
	Provider string   `yaml:"provider"`
	Models   ModelMap `yaml:"models,omitempty"`
}

type TransformRef

type TransformRef struct {
	Source   string `yaml:"source,omitempty"`
	Target   string `yaml:"target"`
	Constant string `yaml:"constant,omitempty"`
}

Jump to

Keyboard shortcuts

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