mapper

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package mapper transforms parsed OpenAPI operations into a Code Mode representation suitable for generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapOptions

type MapOptions struct {
	PackageName       string
	EngineInterface   string
	SearchToolName    string
	ExecuteToolName   string
	ResourceURIPrefix string
	Runtime           string
	ExamplesMode      string
	NoResources       bool

	ExecuteMaxRequests      int
	ExecuteTimeout          time.Duration
	ExecuteMaxResponseBytes int
	ExecuteMaxOutputBytes   int
	ExecuteMaxRedirects     int
}

MapOptions configures mapping for generated Code Mode server code.

type MappedAPI

type MappedAPI struct {
	PackageName       string
	EngineInterface   string
	SearchToolName    string
	ExecuteToolName   string
	ResourceURIPrefix string
	Runtime           string
	ExamplesMode      string

	ExecuteMaxRequests      int
	ExecuteTimeout          time.Duration
	ExecuteMaxResponseBytes int
	ExecuteMaxOutputBytes   int
	ExecuteMaxRedirects     int

	SearchDescription  string
	ExecuteDescription string
	SpecJSON           string
	OperationsJSON     string
	Operations         []MappedOperation
	Schemas            []MappedSchema
	Examples           []MappedExample
}

MappedAPI is the full Code Mode generation input.

func Map

func Map(result *parser.Result, opts MapOptions) (*MappedAPI, error)

Map converts parsed OpenAPI operations into a Code Mode mapping payload.

type MappedExample

type MappedExample struct {
	OperationID string
	Method      string
	Path        string
	Summary     string
	Code        string
}

MappedExample is a generated executable snippet for a specific operation.

type MappedOperation

type MappedOperation struct {
	ID           string
	Method       string
	Path         string
	Summary      string
	Description  string
	Tags         []string
	HasBody      bool
	BodyRequired bool
	Params       []MappedParam
	BodyExample  any
}

MappedOperation is operation metadata exposed to search and examples.

type MappedParam

type MappedParam struct {
	Name     string `json:"name"`
	In       string `json:"in"`
	Required bool   `json:"required"`
	Type     string `json:"type"`
	Example  any    `json:"example,omitempty"`
}

MappedParam is a single operation parameter.

type MappedSchema

type MappedSchema struct {
	Name        string
	Description string
	JSONContent string
}

MappedSchema is a component schema resource entry.

Jump to

Keyboard shortcuts

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