openapi

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Components

type Components struct {
	Schemas         map[string]interface{}    `json:"schemas,omitempty"`
	SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"`
}

type Generator

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

Generator generates OpenAPI specifications for MCP tools

func NewGenerator

func NewGenerator(registry *services.Registry) *Generator

NewGenerator creates a new OpenAPI generator

func (*Generator) Generate

func (g *Generator) Generate() (*OpenAPISpec, error)

Generate generates the complete OpenAPI specification

func (*Generator) SaveToFile

func (g *Generator) SaveToFile(filename string) error

SaveToFile saves the OpenAPI specification to a file

type Info

type Info struct {
	Title       string                  `json:"title"`
	Version     string                  `json:"version"`
	Description string                  `json:"description"`
	Contact     *map[string]interface{} `json:"contact,omitempty"`
	License     *map[string]interface{} `json:"license,omitempty"`
}

type MediaType

type MediaType struct {
	Schema  interface{} `json:"schema"`
	Example interface{} `json:"example,omitempty"`
}

type OpenAPISpec

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

type Operation

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

type Parameter

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

type PathItem

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

type RequestBody

type RequestBody struct {
	Required bool                 `json:"required"`
	Content  map[string]MediaType `json:"content"`
}

type Response

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

type SecurityScheme

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

type Server

type Server struct {
	URL         string                            `json:"url"`
	Description string                            `json:"description"`
	Variables   map[string]map[string]interface{} `json:"variables,omitempty"`
}

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