oas

package
v2.932.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOASReservedPropertyName

func IsOASReservedPropertyName(propertyName string, path []string) bool

IsOASReservedPropertyName provides backward compatibility with the old static function For best performance, use DynamicReservedChecker instances in long-running applications like the LSP

func IsOASReservedPropertyNameSimple

func IsOASReservedPropertyNameSimple(propertyName string) bool

IsOASReservedPropertyNameSimple provides simple checking for backward compatibility

func IsOASReservedPropertyNameWithVersion

func IsOASReservedPropertyNameWithVersion(propertyName string, path []string, version string) bool

IsOASReservedPropertyNameWithVersion provides version-aware checking

Types

type DynamicReservedChecker

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

DynamicReservedChecker provides dynamic OpenAPI reserved property checking

func NewDynamicReservedChecker

func NewDynamicReservedChecker() *DynamicReservedChecker

NewDynamicReservedChecker creates a new dynamic reserved property checker

func NewDynamicReservedCheckerWithManager

func NewDynamicReservedCheckerWithManager(schemaManager *SchemaManager) *DynamicReservedChecker

NewDynamicReservedCheckerWithManager creates a checker with a custom schema manager

func (*DynamicReservedChecker) ClearCache

func (drc *DynamicReservedChecker) ClearCache()

ClearCache clears the internal property context cache

func (*DynamicReservedChecker) GetCachedVersions

func (drc *DynamicReservedChecker) GetCachedVersions() []string

GetCachedVersions returns a list of versions that have been cached

func (*DynamicReservedChecker) GetSupportedVersions

func (drc *DynamicReservedChecker) GetSupportedVersions() []string

GetSupportedVersions returns a list of supported OpenAPI versions

func (*DynamicReservedChecker) IsOASReservedPropertyName

func (drc *DynamicReservedChecker) IsOASReservedPropertyName(propertyName string, path []string, version string) bool

IsOASReservedPropertyName checks if a property is reserved in the given context and OpenAPI version

func (*DynamicReservedChecker) IsOASReservedPropertyNameSimple

func (drc *DynamicReservedChecker) IsOASReservedPropertyNameSimple(propertyName string, version string) bool

IsOASReservedPropertyNameSimple provides simple checking for backward compatibility

func (*DynamicReservedChecker) IsVersionSupported

func (drc *DynamicReservedChecker) IsVersionSupported(version string) bool

IsVersionSupported returns whether the given version is supported

type PropertyContext

type PropertyContext struct {
	PropertyName string
	PathPatterns []string // JSON path patterns where this property is reserved
	Always       bool     // If true, always reserved regardless of context
}

PropertyContext represents where a property can appear and whether it's reserved

type Schema

type Schema struct {
	Properties           map[string]any    `json:"properties"`
	PatternProperties    map[string]any    `json:"patternProperties"`
	Defs                 map[string]Schema `json:"$defs"`
	Items                any               `json:"items"`
	AdditionalProperties any               `json:"additionalProperties"`
	AllOf                []Schema          `json:"allOf"`
	AnyOf                []Schema          `json:"anyOf"`
	OneOf                []Schema          `json:"oneOf"`
	Not                  *Schema           `json:"not"`
	Ref                  string            `json:"$ref"`
}

Schema represents a parsed JSON Schema object

type SchemaManager

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

SchemaManager handles dynamic downloading and caching of OpenAPI schemas

func NewSchemaManager

func NewSchemaManager() *SchemaManager

NewSchemaManager creates a new schema manager with default configuration

func NewSchemaManagerWithConfig

func NewSchemaManagerWithConfig(config SchemaManagerConfig) *SchemaManager

NewSchemaManagerWithConfig creates a new schema manager with custom configuration

func (*SchemaManager) GetSchemaForVersion

func (sm *SchemaManager) GetSchemaForVersion(version string) (*Schema, error)

GetSchemaForVersion returns the parsed schema for the given OpenAPI version

func (*SchemaManager) IsSupported

func (sm *SchemaManager) IsSupported(version string) bool

IsSupported returns whether the given version is supported

type SchemaManagerConfig

type SchemaManagerConfig struct {
	DisableRemoteSchemas bool              // Force offline mode
	CustomSchemaURLs     map[string]string // Override default URLs
	CacheTTL             time.Duration     // HTTP cache TTL
	HTTPTimeout          time.Duration     // Network request timeout
	MaxCacheSize         int               // Maximum number of cached schemas
}

SchemaManagerConfig provides configuration options for the schema manager

func DefaultSchemaManagerConfig

func DefaultSchemaManagerConfig() SchemaManagerConfig

DefaultSchemaManagerConfig returns the default configuration

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a semantic version

Jump to

Keyboard shortcuts

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