Skip to main content

toStructuralSchema

@webda/kubernetes


Function: toStructuralSchema()

toStructuralSchema(schema, definitions?): StructuralSchema

Defined in: kubernetes/src/crd/schema.ts:287

Convert a JSON schema (draft 7, as generated for the models) to a structural schema for a CustomResourceDefinition

  • $ref are inlined (recursive references become free-form values), definitions and $schema dropped
  • allOf branches are merged, anyOf/oneOf with one non-null branch become that branch (nullable), integer or string becomes x-kubernetes-int-or-string, other alternatives free-form values
  • const becomes enum, null types and values become nullable
  • additionalProperties: false is dropped (Kubernetes prunes unknown fields), free-form objects and untyped values keep unknown fields
  • default, unknown formats and keywords Kubernetes does not support are dropped

Parameters​

schema​

JSONSchema7

the JSON schema

definitions?​

Definitions

definitions to resolve $ref with, default to the schema's

Returns​

StructuralSchema

the structural schema