extractor

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractSchema

func ExtractSchema(fields map[string]any, types map[string]any) (*extv1.JSONSchemaProps, error)

ExtractSchema converts a field map using shorthand schema syntax into OpenAPI v3 JSON Schema.

This is the primary API for converting ComponentType/Trait schemas from the compact shorthand format into full JSON Schema that Kubernetes can validate against.

The shorthand syntax allows concise schema definitions:

  • Basic types: replicas: "integer"
  • With constraints: port: "integer | minimum=1 | maximum=65535"
  • With defaults: environment: "string | default=dev"
  • Arrays: tags: "[]string"
  • Maps: labels: "map<string>"
  • Custom types: database: "DatabaseConfig" (references types parameter)

The types parameter provides custom type definitions that can be referenced in field schemas.

Schema behavior:

  • Fields are required by default unless they have a default value
  • Unknown markers cause errors unless they have an allowedUnknownMarkerPrefixes prefix (reserved for custom annotations)
  • The "required" marker is not allowed (use defaults to make fields optional)

Types

This section is empty.

Jump to

Keyboard shortcuts

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