openapi_vocabulary

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const OpenAPIVocabularyURL = "https://pb33f.io/openapi-validator/vocabulary"

OpenAPIVocabularyURL is the vocabulary URL for OpenAPI-specific keywords

Variables

This section is empty.

Functions

func CompileCoercion

func CompileCoercion(ctx *jsonschema.CompilerContext, obj map[string]any, allowCoercion bool) (jsonschema.SchemaExt, error)

CompileCoercion compiles the coercion extension if coercion is allowed and applicable

func CompileDeprecated

func CompileDeprecated(ctx *jsonschema.CompilerContext, obj map[string]any, version VersionType) (jsonschema.SchemaExt, error)

compileDeprecated compiles the deprecated keyword

func CompileDiscriminator

func CompileDiscriminator(_ *jsonschema.CompilerContext, obj map[string]any, _ VersionType) (jsonschema.SchemaExt, error)

CompileDiscriminator compiles the OpenAPI discriminator keyword

func CompileExample

func CompileExample(ctx *jsonschema.CompilerContext, obj map[string]any, version VersionType) (jsonschema.SchemaExt, error)

compileExample compiles the example keyword

func CompileNullable

func CompileNullable(_ *jsonschema.CompilerContext, obj map[string]any, version VersionType) (jsonschema.SchemaExt, error)

compileNullable compiles the nullable keyword based on OpenAPI version

func IsCoercibleType

func IsCoercibleType(schemaType any) bool

IsCoercibleType checks if the schema type is one that supports coercion

func NewOpenAPIVocabulary

func NewOpenAPIVocabulary(version VersionType) *jsonschema.Vocabulary

NewOpenAPIVocabulary creates a vocabulary for OpenAPI-specific keywords version determines which keywords are allowed/forbidden

func NewOpenAPIVocabularyWithCoercion

func NewOpenAPIVocabularyWithCoercion(version VersionType, allowCoercion bool) *jsonschema.Vocabulary

NewOpenAPIVocabularyWithCoercion creates a vocabulary with optional scalar coercion

Types

type CoercionError

type CoercionError struct {
	SourceType string
	TargetType string
	Value      string
	Message    string
}

CoercionError represents an error during scalar type coercion

func (*CoercionError) Error

func (e *CoercionError) Error() string

func (*CoercionError) KeywordPath

func (e *CoercionError) KeywordPath() []string

func (*CoercionError) LocalizedString

func (e *CoercionError) LocalizedString(printer *message.Printer) string

type DiscriminatorPropertyMissingError

type DiscriminatorPropertyMissingError struct {
	PropertyName string
}

DiscriminatorPropertyMissingError represents an error when discriminator property is missing

func (*DiscriminatorPropertyMissingError) Error

func (*DiscriminatorPropertyMissingError) KeywordPath

func (e *DiscriminatorPropertyMissingError) KeywordPath() []string

func (*DiscriminatorPropertyMissingError) LocalizedString

func (e *DiscriminatorPropertyMissingError) LocalizedString(printer *message.Printer) string

type OpenAPIKeywordError

type OpenAPIKeywordError struct {
	Keyword string
	Message string
}

OpenAPIKeywordError represents an error with an OpenAPI-specific keyword

func (*OpenAPIKeywordError) Error

func (e *OpenAPIKeywordError) Error() string

type VersionType

type VersionType int

VersionType represents OpenAPI specification versions

const (
	// Version30 represents OpenAPI 3.0.x
	Version30 VersionType = iota
	// Version31 represents OpenAPI 3.1.x (and later)
	Version31
)

Jump to

Keyboard shortcuts

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