export

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter interface {
	Export(ctx context.Context, spec *model.Spec, cfg ExporterConfig) (*ExporterResult, error)
	IsSupportedVersion(version string) bool
}

func NewExporter

func NewExporter(adapters []ViewAdapter) Exporter

type ExporterConfig

type ExporterConfig struct {
	Version        string
	ShouldValidate bool
}

type ExporterResult

type ExporterResult struct {
	// Result is the marshaled OpenAPI specification as bytes.
	Result []byte

	// Warnings contains any warnings generated during projection.
	// Warnings are generated when features are not supported by the target version.
	Warnings debug.Warnings
}

Result contains the output of spec projection.

type Validator

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

Validator validates OpenAPI specifications against a specific meta-schema. Each validator instance is tied to a specific OpenAPI version.

func NewValidator

func NewValidator(schemaJSON []byte) (*Validator, error)

New creates a new version-specific Validator with the provided meta-schema JSON.

The validator uses santhosh-tekuri/jsonschema which supports both JSON Schema draft-04 (for OpenAPI 3.0) and draft-2020-12 (for OpenAPI 3.1).

Example:

validator, err := validator.New(schemaJSON)
if err != nil {
    log.Fatalf("Failed to create validator: %v", err)
}

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, specJSON []byte) error

Validate validates an OpenAPI specification JSON against the meta-schema.

type ViewAdapter

type ViewAdapter interface {
	View(spec *model.Spec) (any, debug.Warnings, error)
	Version() string
	SchemaJSON() []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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