openapi

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SchemaFrom

func SchemaFrom(typ reflect.Type) *apiext.JSONSchemaProps

SchemaFrom builds an openapi schema for a given type as described by the kubernetes apiextensions server. These schema's are used to translate Go types to openapi to be consumed by CustomResourceDefinitions.

The following JSON Tags are supported and will add their properties to the resulting schema for a given field: "Enum", "XValidations", "Maximum", "Minimum", "MaxLength", "MinLength", "MaxItems", "MinItems", "UniqueItems", "Pattern", "ExclusiveMaximum", "ExclusiveMinimum", "MultipleOf", "Format"

JSON Tags with an improper value (Say a string where an int is expected for example: `MaxLenghth:"hello"`) will cause a panic.

Types

type Duration

type Duration time.Duration

func (Duration) Duration

func (d Duration) Duration() time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) OpenAPISchema

func (Duration) OpenAPISchema() *apiext.JSONSchemaProps

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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