openapi

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 9 Imported by: 4

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

This section is empty.

Jump to

Keyboard shortcuts

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