Documentation
¶
Overview ¶
Package generator generates language-specific schemas for Crossplane and Kubernetes resources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToJSONSchema ¶ added in v2.4.0
func ToJSONSchema(s any, gvk runtimeSchema.GroupVersionKind) (*jsonschema.Schema, error)
ToJSONSchema converts any JSON-compatible schema (e.g., *spec.Schema or *extv1.JSONSchemaProps) to a *jsonschema.Schema with YAML language server compatibility fixes applied. When gvk is non-empty, it also sets $id and x-kubernetes-group-version-kind metadata.
Types ¶
type CRDJSONSchema ¶ added in v2.5.0
CRDJSONSchema holds a marshaled JSON Schema derived from a single CRD version.
func CRDsToJSONSchemas ¶ added in v2.5.0
func CRDsToJSONSchemas(crds []*extv1.CustomResourceDefinition) ([]CRDJSONSchema, error)
CRDsToJSONSchemas converts CRD OpenAPI v3 schemas to marshaled JSON Schemas.
type Interface ¶
type Interface interface {
Language() string
GenerateFromCRD(ctx context.Context, fs afero.Fs, runner runner.SchemaRunner) (afero.Fs, error)
GenerateFromOpenAPI(ctx context.Context, fs afero.Fs, runner runner.SchemaRunner) (afero.Fs, error)
}
Interface generates schemas for a specific language.
func AllLanguages ¶
AllLanguages returns generators for all supported languages. The set of supported language identifiers is defined by devv1alpha1.SupportedSchemaLanguages.
type Option ¶ added in v2.5.0
type Option func(*options)
Option configures the generators returned by AllLanguages.
func WithGoModelAccessors ¶ added in v2.5.0
WithGoModelAccessors enables generation of GetX/SetX accessor methods on the generated Go models. It is disabled by default and gated behind the features.generateGoModelAccessors config flag.
func WithGoRuntimeObjects ¶ added in v2.5.0
WithGoRuntimeObjects enables generation of runtime.Object methods (DeepCopy, GetObjectKind, DeepCopyObject) and per-package AddToScheme helpers on the generated Go models. Disabled by default; gated behind the features.generateGoRuntimeObjects config flag.