@intentius/chant-lexicon-k8s 0.44.13 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/codegen/docs.d.ts.map +1 -1
  2. package/dist/codegen/generate-lexicon.d.ts +15 -1
  3. package/dist/codegen/generate-lexicon.d.ts.map +1 -1
  4. package/dist/components/capability-plugin.d.ts.map +1 -1
  5. package/dist/crd/parser.d.ts +28 -1
  6. package/dist/crd/parser.d.ts.map +1 -1
  7. package/dist/deep-observe-hooks.d.ts +60 -4
  8. package/dist/deep-observe-hooks.d.ts.map +1 -1
  9. package/dist/deep-observe.d.ts +36 -61
  10. package/dist/deep-observe.d.ts.map +1 -1
  11. package/dist/integrity.json +6 -3
  12. package/dist/lint/audit-catalog.d.ts.map +1 -1
  13. package/dist/lint/post-synth/crd-schema-helpers.d.ts +49 -0
  14. package/dist/lint/post-synth/crd-schema-helpers.d.ts.map +1 -0
  15. package/dist/lint/post-synth/index.d.ts.map +1 -1
  16. package/dist/lint/post-synth/wk8501.d.ts +14 -0
  17. package/dist/lint/post-synth/wk8501.d.ts.map +1 -0
  18. package/dist/lint/post-synth/wk8502.d.ts +13 -0
  19. package/dist/lint/post-synth/wk8502.d.ts.map +1 -0
  20. package/dist/manifest.json +1 -1
  21. package/dist/meta.json +126 -63
  22. package/dist/okf/index.md +2 -0
  23. package/dist/okf/rules/WK8501.md +11 -0
  24. package/dist/okf/rules/WK8502.md +11 -0
  25. package/dist/rules/crd-schema-helpers.ts +228 -0
  26. package/dist/rules/wk8501.ts +40 -0
  27. package/dist/rules/wk8502.ts +39 -0
  28. package/dist/spec/parse.d.ts +32 -0
  29. package/dist/spec/parse.d.ts.map +1 -1
  30. package/dist/validate.d.ts.map +1 -1
  31. package/package.json +3 -3
  32. package/src/codegen/docs.ts +0 -1044
  33. package/src/codegen/generate-lexicon.ts +38 -2
  34. package/src/codegen/snapshot.test.ts +20 -0
  35. package/src/components/capability-plugin.test.ts +20 -0
  36. package/src/components/capability-plugin.ts +5 -2
  37. package/src/crd/cnpg.test.ts +1 -1
  38. package/src/crd/infisical.test.ts +1 -1
  39. package/src/crd/parser.test.ts +117 -1
  40. package/src/crd/parser.ts +71 -5
  41. package/src/crd/traefik.test.ts +1 -1
  42. package/src/deep-observe-hooks.ts +78 -16
  43. package/src/deep-observe.test.ts +145 -29
  44. package/src/deep-observe.ts +43 -85
  45. package/src/generated/lexicon-k8s.json +126 -63
  46. package/src/lint/audit-catalog.ts +2 -0
  47. package/src/lint/post-synth/crd-schema-helpers.ts +228 -0
  48. package/src/lint/post-synth/index.ts +4 -0
  49. package/src/lint/post-synth/post-synth.test.ts +156 -0
  50. package/src/lint/post-synth/wk8501.ts +40 -0
  51. package/src/lint/post-synth/wk8502.ts +39 -0
  52. package/src/list-map-key-table.test.ts +83 -0
  53. package/src/op/activities/kubectl.ts +2 -2
  54. package/src/serializer.test.ts +4 -4
  55. package/src/spec/parse.ts +33 -0
  56. package/src/validate.ts +7 -4
package/src/spec/parse.ts CHANGED
@@ -78,6 +78,33 @@ export interface ParsedOperation {
78
78
  verbs: string[];
79
79
  }
80
80
 
81
+ /**
82
+ * Compact, recursive field schema for a custom resource's `spec` — chant #1372.
83
+ *
84
+ * Built-in kinds get their field typing from the generated `.d.ts`. A CRD's
85
+ * constructor takes `spec: Record<string, unknown>`, so its field names, enums
86
+ * and scalar types have to travel through the lexicon JSON instead. This is
87
+ * the shape that ships there: no descriptions, no numeric bounds, only what a
88
+ * validator needs to reject a misspelled field or a wrong-typed value.
89
+ */
90
+ export interface CrdFieldSchema {
91
+ /** OpenAPI type; `integer` is kept distinct from `number`. Absent when the schema says nothing. */
92
+ type?: "string" | "integer" | "number" | "boolean" | "object" | "array";
93
+ enum?: string[];
94
+ /** Object members, keyed by field name. */
95
+ fields?: Record<string, CrdFieldSchema>;
96
+ /** Required member names of an object. */
97
+ required?: string[];
98
+ /** Element schema of an array. */
99
+ items?: CrdFieldSchema;
100
+ /**
101
+ * True when the object accepts members its `fields` do not list —
102
+ * `x-kubernetes-preserve-unknown-fields` or `additionalProperties`.
103
+ * `x-kubernetes-int-or-string` also sets it on a scalar, meaning either type passes.
104
+ */
105
+ open?: true;
106
+ }
107
+
81
108
  export interface K8sParseResult {
82
109
  resource: ParsedResource;
83
110
  propertyTypes: ParsedPropertyType[];
@@ -87,6 +114,12 @@ export interface K8sParseResult {
87
114
  isProperty?: boolean;
88
115
  /** How the API addresses this resource. Absent for property types. */
89
116
  operation?: ParsedOperation;
117
+ /**
118
+ * The `spec` field schema of a custom resource (chant #1372). Present only
119
+ * for CRD-derived kinds whose `openAPIV3Schema` declares a `spec`; built-in
120
+ * kinds carry their typing in the `.d.ts` instead.
121
+ */
122
+ specSchema?: CrdFieldSchema;
90
123
  }
91
124
 
92
125
  // ── Swagger types ──────────────────────────────────────────────────
package/src/validate.ts CHANGED
@@ -42,9 +42,12 @@ export async function validate(opts?: { basePath?: string }): Promise<ValidateRe
42
42
  lexiconJsonFilename: "lexicon-k8s.json",
43
43
  requiredNames: REQUIRED_NAMES,
44
44
  basePath,
45
- // chant #1475 — the k8s baseline was re-baselined together with the k3s
46
- // CRD work (#1605), so a release must now verify the API it ships is the
47
- // reviewed one. Runs only under CHANT_RELEASE_GATE=1.
48
- checkSurfaceSnapshot: true,
45
+ // chant #1475 — the baseline was re-baselined with the k3s CRD work
46
+ // (#1605). k8s generates from a pinned kubernetes release tag plus CRDs
47
+ // vendored in this repo, so a fresh generate is deterministic and the
48
+ // surface can only move through a change here. Gate on every validate,
49
+ // not just under CHANT_RELEASE_GATE, so a CRD batch can no longer leave
50
+ // the snapshot behind the way #1319/#1320/#1321 did.
51
+ checkSurfaceSnapshot: "always",
49
52
  });
50
53
  }