build

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JSON Schema type constants.
	TypeString  = "string"
	TypeArray   = "array"
	TypeObject  = "object"
	TypeBoolean = "boolean"
	TypeInteger = "integer"
	TypeNumber  = "number"
)

Variables

This section is empty.

Functions

func NewMetadata

func NewMetadata(cfg config.TagConfig) *schema.Metadata

NewMetadata creates a new schema metadata instance with the given tag configuration. Partial configs are merged with defaults using config.MergeTagConfig().

Types

type BaseRoute

type BaseRoute struct {
	Operation     *model.Operation
	DefaultStatus int
	Errors        []int
}

BaseRoute represents route information needed for response extraction.

type ContentTypeProvider

type ContentTypeProvider interface {
	ContentType(string) string
}

ContentTypeProvider allows you to override the content type for responses, allowing you to return a different content type like `application/problem+json` after using the `application/json` marshaller. This should be implemented by the response body struct.

type RequestBuilder

type RequestBuilder interface {
	BuildRequest(op *model.Operation, inputType reflect.Type) error
}

func NewRequestBuilder

func NewRequestBuilder(generator *SchemaGenerator, metadata *schema.Metadata, tagCfg config.TagConfig) RequestBuilder

NewRequestBuilder creates a new request builder.

type ResponseBuilder

type ResponseBuilder interface {
	BuildOperationResponses(op *model.Operation, responses map[int]reflect.Type) error
}

func NewResponseBuilder

func NewResponseBuilder(generator *SchemaGenerator, metadata *schema.Metadata, tagCfg config.TagConfig) ResponseBuilder

NewResponseBuilder creates a new response builder.

type SchemaGenerator

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

SchemaGenerator generates and caches OpenAPI schemas from Go types. It handles schema generation, caching, reference management, and type aliases.

func NewSchemaGenerator

func NewSchemaGenerator(prefix string, m *schema.Metadata, tagCfg config.TagConfig) *SchemaGenerator

NewSchemaGenerator creates a new schema generator with the given configuration.

func (*SchemaGenerator) Schema

func (g *SchemaGenerator) Schema(t reflect.Type) *model.Schema

Schema generates a schema for the given type. It handles caching, references, and type aliases automatically. For most use cases, this is the only method needed.

func (*SchemaGenerator) Schemas

func (g *SchemaGenerator) Schemas() map[string]*model.Schema

Schemas returns all generated schemas as a map, suitable for OpenAPI components/schemas. Inline-only schemas (marked via MarkInlineOnly) are excluded.

Jump to

Keyboard shortcuts

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