oas31

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package oas31 contains an implementation of the OAS v3.1 JSON Schema specification https://spec.openapis.org/oas/v3.1.0#schema-object

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate added in v0.2.2

func Validate(ctx context.Context, schema JSONSchema, opts ...validation.Option) []error

Types

type Discriminator

type Discriminator struct {
	marshaller.Model[core.Discriminator]

	// PropertyName is the name of the property in the payload that will hold the discriminator value.
	PropertyName string
	// Mapping is an object to hold mappings between payload values and schema names or references.
	Mapping *sequencedmap.Map[string, string]
	// Extensions provides a list of extensions to the Discriminator object.
	Extensions *extensions.Extensions
}

Discriminator is used to aid in serialization, deserialization, and validation of the oneOf, anyOf and allOf schemas.

func (*Discriminator) GetExtensions added in v0.2.2

func (d *Discriminator) GetExtensions() *extensions.Extensions

GetExtensions returns the value of the Extensions field. Returns nil if not set.

func (*Discriminator) GetMapping added in v0.2.2

func (d *Discriminator) GetMapping() *sequencedmap.Map[string, string]

GetMapping returns the value of the Mapping field. Returns nil if not set.

func (*Discriminator) GetPropertyName added in v0.2.2

func (d *Discriminator) GetPropertyName() string

GetPropertyName returns the value of the PropertyName field. Returns empty string if not set.

func (*Discriminator) Validate added in v0.2.2

func (d *Discriminator) Validate(ctx context.Context, opts ...validation.Option) []error

Validate will validate the Discriminator object according to the OpenAPI Specification.

type ExclusiveMaximum

type ExclusiveMaximum = *values.EitherValue[bool, bool, float64, float64]

func NewExclusiveMaximumFromBool

func NewExclusiveMaximumFromBool(value bool) ExclusiveMaximum

func NewExclusiveMaximumFromFloat64

func NewExclusiveMaximumFromFloat64(value float64) ExclusiveMaximum

type ExclusiveMinimum

type ExclusiveMinimum = *values.EitherValue[bool, bool, float64, float64]

func NewExclusiveMinimumFromBool

func NewExclusiveMinimumFromBool(value bool) ExclusiveMinimum

func NewExclusiveMinimumFromFloat64

func NewExclusiveMinimumFromFloat64(value float64) ExclusiveMinimum

type ExternalDocumentation added in v0.2.2

type ExternalDocumentation struct {
	marshaller.Model[core.ExternalDocumentation]

	// Description is a description of the target documentation. May contain CommonMark syntax.
	Description *string
	// URL is the URL for the target documentation.
	URL string
	// Extensions provides a list of extensions to the ExternalDocumentation object.
	Extensions *extensions.Extensions
}

ExternalDocumentation allows referencing external documentation for the associated object.

func (*ExternalDocumentation) GetDescription added in v0.2.2

func (e *ExternalDocumentation) GetDescription() string

GetDescription returns the value of the Description field. Returns an empty string if not set.

func (*ExternalDocumentation) GetExtensions added in v0.2.2

func (e *ExternalDocumentation) GetExtensions() *extensions.Extensions

GetExtensions returns the value of the Extensions field. Returns nil if not set.

func (*ExternalDocumentation) GetURL added in v0.2.2

func (e *ExternalDocumentation) GetURL() string

GetURL returns the value of the URL field. Returns an empty string if not set.

func (*ExternalDocumentation) Validate added in v0.2.2

func (e *ExternalDocumentation) Validate(ctx context.Context, opts ...validation.Option) []error

Validate will validate the ExternalDocumentation object according to the OpenAPI Specification.

type JSONSchema

type JSONSchema = *values.EitherValue[Schema, core.Schema, bool, bool]

func NewJSONSchemaFromBool

func NewJSONSchemaFromBool(value bool) JSONSchema

func NewJSONSchemaFromSchema

func NewJSONSchemaFromSchema(value *Schema) JSONSchema

func NewJSONSchemaOrBoolFromBool

func NewJSONSchemaOrBoolFromBool(value bool) JSONSchema

func NewJSONSchemaOrBoolFromJSONSchema

func NewJSONSchemaOrBoolFromJSONSchema(value Schema) JSONSchema

type Reference

type Reference[T any] struct{}

type Schema

type Schema struct {
	marshaller.Model[core.Schema]

	Ref              *string
	ExclusiveMaximum ExclusiveMaximum
	ExclusiveMinimum ExclusiveMinimum
	// Type represents the type of a schema either an array of types or a single type.
	Type                  Type
	AllOf                 []JSONSchema
	OneOf                 []JSONSchema
	AnyOf                 []JSONSchema
	Discriminator         *Discriminator
	Examples              []values.Value
	PrefixItems           []JSONSchema
	Contains              JSONSchema
	MinContains           *int64
	MaxContains           *int64
	If                    JSONSchema
	Else                  JSONSchema
	Then                  JSONSchema
	DependentSchemas      *sequencedmap.Map[string, JSONSchema]
	PatternProperties     *sequencedmap.Map[string, JSONSchema]
	PropertyNames         JSONSchema
	UnevaluatedItems      JSONSchema
	UnevaluatedProperties JSONSchema
	Items                 JSONSchema
	Anchor                *string
	Not                   JSONSchema
	Properties            *sequencedmap.Map[string, JSONSchema]
	Title                 *string
	MultipleOf            *float64
	Maximum               *float64
	Minimum               *float64
	MaxLength             *int64
	MinLength             *int64
	Pattern               *string
	Format                *string
	MaxItems              *int64
	MinItems              *int64
	UniqueItems           *bool
	MaxProperties         *int64
	MinProperties         *int64
	Required              []string
	Enum                  []values.Value
	AdditionalProperties  JSONSchema
	Description           *string
	Default               values.Value
	Const                 values.Value
	Nullable              *bool
	ReadOnly              *bool
	WriteOnly             *bool
	ExternalDocs          *ExternalDocumentation
	Example               values.Value
	Deprecated            *bool
	Schema                *string
	XML                   *XML
	Extensions            *extensions.Extensions
}

func (*Schema) GetAdditionalProperties added in v0.2.2

func (s *Schema) GetAdditionalProperties() JSONSchema

GetAdditionalProperties returns the value of the AdditionalProperties field. Returns nil if not set.

func (*Schema) GetAllOf added in v0.2.2

func (s *Schema) GetAllOf() []JSONSchema

GetAllOf returns the value of the AllOf field. Returns nil if not set.

func (*Schema) GetAnchor added in v0.2.2

func (s *Schema) GetAnchor() string

GetAnchor returns the value of the Anchor field. Returns empty string if not set.

func (*Schema) GetAnyOf added in v0.2.2

func (s *Schema) GetAnyOf() []JSONSchema

GetAnyOf returns the value of the AnyOf field. Returns nil if not set.

func (*Schema) GetConst added in v0.2.2

func (s *Schema) GetConst() values.Value

GetConst returns the value of the Const field. Returns nil if not set.

func (*Schema) GetContains added in v0.2.2

func (s *Schema) GetContains() JSONSchema

GetContains returns the value of the Contains field. Returns nil if not set.

func (*Schema) GetDefault added in v0.2.2

func (s *Schema) GetDefault() values.Value

GetDefault returns the value of the Default field. Returns nil if not set.

func (*Schema) GetDependentSchemas added in v0.2.2

func (s *Schema) GetDependentSchemas() *sequencedmap.Map[string, JSONSchema]

GetDependentSchemas returns the value of the DependentSchemas field. Returns nil if not set.

func (*Schema) GetDeprecated added in v0.2.2

func (s *Schema) GetDeprecated() bool

GetDeprecated returns the value of the Deprecated field. Returns false if not set.

func (*Schema) GetDescription added in v0.2.2

func (s *Schema) GetDescription() string

GetDescription returns the value of the Description field. Returns empty string if not set.

func (*Schema) GetDiscriminator added in v0.2.2

func (s *Schema) GetDiscriminator() *Discriminator

GetDiscriminator returns the value of the Discriminator field. Returns nil if not set.

func (*Schema) GetElse added in v0.2.2

func (s *Schema) GetElse() JSONSchema

GetElse returns the value of the Else field. Returns nil if not set.

func (*Schema) GetEnum added in v0.2.2

func (s *Schema) GetEnum() []values.Value

GetEnum returns the value of the Enum field. Returns nil if not set.

func (*Schema) GetExample added in v0.2.2

func (s *Schema) GetExample() values.Value

GetExample returns the value of the Example field. Returns nil if not set.

func (*Schema) GetExamples added in v0.2.2

func (s *Schema) GetExamples() []values.Value

GetExamples returns the value of the Examples field. Returns nil if not set.

func (*Schema) GetExclusiveMaximum added in v0.2.2

func (s *Schema) GetExclusiveMaximum() ExclusiveMaximum

GetExclusiveMaximum returns the value of the ExclusiveMaximum field. Returns nil if not set.

func (*Schema) GetExclusiveMinimum added in v0.2.2

func (s *Schema) GetExclusiveMinimum() ExclusiveMinimum

GetExclusiveMinimum returns the value of the ExclusiveMinimum field. Returns nil if not set.

func (*Schema) GetExtensions added in v0.2.2

func (s *Schema) GetExtensions() *extensions.Extensions

GetExtensions returns the value of the Extensions field. Returns nil if not set.

func (*Schema) GetExternalDocs added in v0.2.2

func (s *Schema) GetExternalDocs() *ExternalDocumentation

GetExternalDocs returns the value of the ExternalDocs field. Returns nil if not set.

func (*Schema) GetFormat added in v0.2.2

func (s *Schema) GetFormat() string

GetFormat returns the value of the Format field. Returns empty string if not set.

func (*Schema) GetIf added in v0.2.2

func (s *Schema) GetIf() JSONSchema

GetIf returns the value of the If field. Returns nil if not set.

func (*Schema) GetItems added in v0.2.2

func (s *Schema) GetItems() JSONSchema

GetItems returns the value of the Items field. Returns nil if not set.

func (*Schema) GetMaxContains added in v0.2.2

func (s *Schema) GetMaxContains() *int64

GetMaxContains returns the value of the MaxContains field. Returns nil if not set.

func (*Schema) GetMaxItems added in v0.2.2

func (s *Schema) GetMaxItems() *int64

GetMaxItems returns the value of the MaxItems field. Returns nil if not set.

func (*Schema) GetMaxLength added in v0.2.2

func (s *Schema) GetMaxLength() *int64

GetMaxLength returns the value of the MaxLength field. Returns nil if not set.

func (*Schema) GetMaxProperties added in v0.2.2

func (s *Schema) GetMaxProperties() *int64

GetMaxProperties returns the value of the MaxProperties field. Returns nil if not set.

func (*Schema) GetMaximum added in v0.2.2

func (s *Schema) GetMaximum() *float64

GetMaximum returns the value of the Maximum field. Returns nil if not set.

func (*Schema) GetMinContains added in v0.2.2

func (s *Schema) GetMinContains() *int64

GetMinContains returns the value of the MinContains field. Returns nil if not set.

func (*Schema) GetMinItems added in v0.2.2

func (s *Schema) GetMinItems() *int64

GetMinItems returns the value of the MinItems field. Returns nil if not set.

func (*Schema) GetMinLength added in v0.2.2

func (s *Schema) GetMinLength() *int64

GetMinLength returns the value of the MinLength field. Returns nil if not set.

func (*Schema) GetMinProperties added in v0.2.2

func (s *Schema) GetMinProperties() *int64

GetMinProperties returns the value of the MinProperties field. Returns nil if not set.

func (*Schema) GetMinimum added in v0.2.2

func (s *Schema) GetMinimum() *float64

GetMinimum returns the value of the Minimum field. Returns nil if not set.

func (*Schema) GetMultipleOf added in v0.2.2

func (s *Schema) GetMultipleOf() *float64

GetMultipleOf returns the value of the MultipleOf field. Returns nil if not set.

func (*Schema) GetNot added in v0.2.2

func (s *Schema) GetNot() JSONSchema

GetNot returns the value of the Not field. Returns nil if not set.

func (*Schema) GetNullable added in v0.2.2

func (s *Schema) GetNullable() bool

GetNullable returns the value of the Nullable field. Returns false if not set.

func (*Schema) GetOneOf added in v0.2.2

func (s *Schema) GetOneOf() []JSONSchema

GetOneOf returns the value of the OneOf field. Returns nil if not set.

func (*Schema) GetPattern added in v0.2.2

func (s *Schema) GetPattern() string

GetPattern returns the value of the Pattern field. Returns empty string if not set.

func (*Schema) GetPatternProperties added in v0.2.2

func (s *Schema) GetPatternProperties() *sequencedmap.Map[string, JSONSchema]

GetPatternProperties returns the value of the PatternProperties field. Returns nil if not set.

func (*Schema) GetPrefixItems added in v0.2.2

func (s *Schema) GetPrefixItems() []JSONSchema

GetPrefixItems returns the value of the PrefixItems field. Returns nil if not set.

func (*Schema) GetProperties added in v0.2.2

func (s *Schema) GetProperties() *sequencedmap.Map[string, JSONSchema]

GetProperties returns the value of the Properties field. Returns nil if not set.

func (*Schema) GetPropertyNames added in v0.2.2

func (s *Schema) GetPropertyNames() JSONSchema

GetPropertyNames returns the value of the PropertyNames field. Returns nil if not set.

func (*Schema) GetReadOnly added in v0.2.2

func (s *Schema) GetReadOnly() bool

GetReadOnly returns the value of the ReadOnly field. Returns false if not set.

func (*Schema) GetRef added in v0.2.2

func (s *Schema) GetRef() string

GetRef returns the value of the Ref field. Returns empty string if not set.

func (*Schema) GetRequired added in v0.2.2

func (s *Schema) GetRequired() []string

GetRequired returns the value of the Required field. Returns nil if not set.

func (*Schema) GetSchema added in v0.2.2

func (s *Schema) GetSchema() string

GetSchema returns the value of the Schema field. Returns empty string if not set.

func (*Schema) GetThen added in v0.2.2

func (s *Schema) GetThen() JSONSchema

GetThen returns the value of the Then field. Returns nil if not set.

func (*Schema) GetTitle added in v0.2.2

func (s *Schema) GetTitle() string

GetTitle returns the value of the Title field. Returns empty string if not set.

func (*Schema) GetType added in v0.2.2

func (s *Schema) GetType() []SchemaType

GetType will resolve the type of the schema to an array of the types represented by this schema.

func (*Schema) GetUnevaluatedItems added in v0.2.2

func (s *Schema) GetUnevaluatedItems() JSONSchema

GetUnevaluatedItems returns the value of the UnevaluatedItems field. Returns nil if not set.

func (*Schema) GetUnevaluatedProperties added in v0.2.2

func (s *Schema) GetUnevaluatedProperties() JSONSchema

GetUnevaluatedProperties returns the value of the UnevaluatedProperties field. Returns nil if not set.

func (*Schema) GetUniqueItems added in v0.2.2

func (s *Schema) GetUniqueItems() bool

GetUniqueItems returns the value of the UniqueItems field. Returns false if not set.

func (*Schema) GetWriteOnly added in v0.2.2

func (s *Schema) GetWriteOnly() bool

GetWriteOnly returns the value of the WriteOnly field. Returns false if not set.

func (*Schema) GetXML added in v0.2.2

func (s *Schema) GetXML() *XML

GetXML returns the value of the XML field. Returns nil if not set.

func (*Schema) Validate

func (js *Schema) Validate(ctx context.Context, opts ...validation.Option) []error

type SchemaType added in v0.2.2

type SchemaType string
const (
	SchemaTypeArray   SchemaType = "array"
	SchemaTypeBoolean SchemaType = "boolean"
	SchemaTypeInteger SchemaType = "integer"
	SchemaTypeNumber  SchemaType = "number"
	SchemaTypeNull    SchemaType = "null"
	SchemaTypeObject  SchemaType = "object"
	SchemaTypeString  SchemaType = "string"
)

type Type

Type represents the type of a schema either an array of types or a single type.

func NewTypeFromArray

func NewTypeFromArray(value []SchemaType) Type

func NewTypeFromString

func NewTypeFromString(value SchemaType) Type

type XML added in v0.2.2

type XML struct {
	marshaller.Model[core.XML]

	// Name replaces the name of the element/attribute used for the described schema property.
	Name *string
	// Namespace defines a URI of the namespace definition. Value MUST be in the form of an absolute URI.
	Namespace *string
	// Prefix to be used for the name.
	Prefix *string
	// Attribute determines whether the property definition creates an attribute.
	Attribute *bool
	// Wrapped determines whether the property definition is wrapped.
	Wrapped *bool
	// Extensions provides a list of extensions to the XML object.
	Extensions *extensions.Extensions
}

XML represents the metadata of a schema describing a XML element.

func (*XML) GetAttribute added in v0.2.2

func (x *XML) GetAttribute() bool

GetAttribute returns the value of the Attribute field. Returns empty string if not set.

func (*XML) GetExtensions added in v0.2.2

func (x *XML) GetExtensions() *extensions.Extensions

GetExtensions returns the value of the Extensions field. Returns nil if not set.

func (*XML) GetName added in v0.2.2

func (x *XML) GetName() string

GetName returns the value of the Name field. Returns empty string if not set.

func (*XML) GetNamespace added in v0.2.2

func (x *XML) GetNamespace() string

GetNamespace returns the value of the Namespace field. Returns empty string if not set.

func (*XML) GetPrefix added in v0.2.2

func (x *XML) GetPrefix() string

GetPrefix returns the value of the Prefix field. Returns empty string if not set.

func (*XML) GetWrapped added in v0.2.2

func (x *XML) GetWrapped() bool

GetWrapped returns the value of the Wrapped field. Returns empty string if not set.

func (*XML) Validate added in v0.2.2

func (x *XML) Validate(ctx context.Context, opts ...validation.Option) []error

Validate will validate the XML object according to the OpenAPI Specification.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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