schema-components 1.18.1 → 1.20.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 (68) hide show
  1. package/dist/core/adapter.d.mts +2 -2
  2. package/dist/core/adapter.mjs +128 -15
  3. package/dist/core/constraints.d.mts +2 -2
  4. package/dist/core/diagnostics.d.mts +1 -1
  5. package/dist/core/errors.d.mts +1 -1
  6. package/dist/core/errors.mjs +15 -1
  7. package/dist/core/fieldOrder.d.mts +1 -1
  8. package/dist/core/formats.d.mts +21 -14
  9. package/dist/core/formats.mjs +96 -4
  10. package/dist/core/merge.d.mts +1 -1
  11. package/dist/core/normalise.d.mts +38 -5
  12. package/dist/core/normalise.mjs +2 -2
  13. package/dist/core/openapi30.d.mts +33 -4
  14. package/dist/core/openapi30.mjs +2 -2
  15. package/dist/core/ref.d.mts +1 -1
  16. package/dist/core/renderer.d.mts +1 -1
  17. package/dist/core/renderer.mjs +7 -2
  18. package/dist/core/swagger2.d.mts +1 -1
  19. package/dist/core/swagger2.mjs +1 -1
  20. package/dist/core/typeInference.d.mts +2 -2
  21. package/dist/core/types.d.mts +1 -1
  22. package/dist/core/uri.d.mts +41 -0
  23. package/dist/core/uri.mjs +76 -0
  24. package/dist/core/version.d.mts +2 -2
  25. package/dist/core/version.mjs +43 -9
  26. package/dist/core/walkBuilders.d.mts +3 -3
  27. package/dist/core/walker.d.mts +1 -1
  28. package/dist/core/walker.mjs +50 -3
  29. package/dist/{diagnostics-BYk63jsC.d.mts → diagnostics-CbBPsxSt.d.mts} +1 -1
  30. package/dist/{errors-C5zRC2PU.d.mts → errors-C2iABcn9.d.mts} +14 -2
  31. package/dist/html/a11y.d.mts +2 -2
  32. package/dist/html/renderToHtml.d.mts +2 -2
  33. package/dist/html/renderToHtmlStream.d.mts +2 -2
  34. package/dist/html/renderers.d.mts +2 -2
  35. package/dist/html/renderers.mjs +37 -2
  36. package/dist/html/streamRenderers.d.mts +2 -2
  37. package/dist/normalise-CMMEl4cd.mjs +1306 -0
  38. package/dist/openapi/ApiCallbacks.d.mts +1 -1
  39. package/dist/openapi/ApiLinks.d.mts +1 -1
  40. package/dist/openapi/ApiResponseHeaders.d.mts +1 -1
  41. package/dist/openapi/ApiSecurity.d.mts +1 -1
  42. package/dist/openapi/bundle.mjs +2 -0
  43. package/dist/openapi/components.d.mts +2 -2
  44. package/dist/openapi/components.mjs +20 -5
  45. package/dist/openapi/parser.d.mts +1 -1
  46. package/dist/openapi/parser.mjs +6 -1
  47. package/dist/openapi/resolve.d.mts +17 -6
  48. package/dist/openapi/resolve.mjs +45 -7
  49. package/dist/react/SchemaComponent.d.mts +21 -9
  50. package/dist/react/SchemaComponent.mjs +3 -13
  51. package/dist/react/SchemaView.d.mts +3 -3
  52. package/dist/react/SchemaView.mjs +1 -0
  53. package/dist/react/fieldPath.d.mts +1 -1
  54. package/dist/react/headless.d.mts +7 -1
  55. package/dist/react/headless.mjs +13 -1
  56. package/dist/react/headlessRenderers.d.mts +54 -3
  57. package/dist/react/headlessRenderers.mjs +153 -3
  58. package/dist/{ref-Ckt5liZs.d.mts → ref-C8JbwfiS.d.mts} +1 -1
  59. package/dist/{renderer-BAGoX4AK.d.mts → renderer-SOIbJBtk.d.mts} +9 -3
  60. package/dist/themes/mantine.d.mts +1 -1
  61. package/dist/themes/mui.d.mts +1 -1
  62. package/dist/themes/radix.d.mts +1 -1
  63. package/dist/themes/shadcn.d.mts +1 -1
  64. package/dist/{typeInference-5JiqIZ8t.d.mts → typeInference-CDoD_LZ_.d.mts} +187 -42
  65. package/dist/{types-D_5ST7SS.d.mts → types-C9zw9wbX.d.mts} +6 -0
  66. package/dist/{version-B5NV-35j.d.mts → version-D-u7aMfy.d.mts} +43 -1
  67. package/package.json +1 -1
  68. package/dist/normalise-tL9FckAk.mjs +0 -748
@@ -7,6 +7,13 @@
7
7
  * before the walker processes the schema.
8
8
  */
9
9
  type JsonSchemaDraft = "draft-04" | "draft-06" | "draft-07" | "draft-2019-09" | "draft-2020-12";
10
+ /**
11
+ * Match a `$schema` URI string to a known draft. Returns `undefined`
12
+ * when the URI matches none of the documented Draft 04 – Draft 2020-12
13
+ * schema URIs (including the known prefix patterns) — callers can use
14
+ * this to distinguish an authoritative match from a silent fallback.
15
+ */
16
+ declare function matchJsonSchemaDraftUri(uri: string): JsonSchemaDraft | undefined;
10
17
  /**
11
18
  * Detect the JSON Schema draft version from a schema's `$schema` URI.
12
19
  * When `$schema` is absent, uses heuristic keyword detection via
@@ -65,5 +72,40 @@ declare function isOpenApi31(version: OpenApiVersionInfo): boolean;
65
72
  * Check if a document is Swagger 2.0.
66
73
  */
67
74
  declare function isSwagger2(version: OpenApiVersionInfo): boolean;
75
+ /**
76
+ * Result of inspecting a document for the OpenAPI 3.1 `jsonSchemaDialect`
77
+ * keyword.
78
+ *
79
+ * - `kind: "absent"`: the keyword is not declared. The walker assumes
80
+ * Draft 2020-12, which is the spec-defined default.
81
+ * - `kind: "known"`: the declared dialect URI matches one of the
82
+ * supported drafts. The corresponding `JsonSchemaDraft` is returned so
83
+ * the normaliser can route to the matching per-node transforms.
84
+ * - `kind: "unknown"`: the keyword is present but its URI does not
85
+ * match any supported draft. The caller should emit an
86
+ * `unknown-json-schema-dialect` diagnostic and fall back to
87
+ * Draft 2020-12.
88
+ */
89
+ type JsonSchemaDialectInfo = {
90
+ kind: "absent";
91
+ } | {
92
+ kind: "known";
93
+ uri: string;
94
+ draft: JsonSchemaDraft;
95
+ } | {
96
+ kind: "unknown";
97
+ uri: string;
98
+ };
99
+ /**
100
+ * Inspect an OpenAPI 3.1 document for a `jsonSchemaDialect` declaration.
101
+ *
102
+ * Per the OpenAPI 3.1 spec, an OpenAPI document may declare the default
103
+ * JSON Schema dialect for its Schema Objects via the top-level
104
+ * `jsonSchemaDialect` URI. Real-world 3.1 documents overwhelmingly omit
105
+ * the keyword and rely on the spec-defined Draft 2020-12 default — this
106
+ * helper surfaces the declaration so the normaliser can either honour a
107
+ * known dialect or emit a diagnostic for an unknown one.
108
+ */
109
+ declare function readJsonSchemaDialect(doc: Record<string, unknown>): JsonSchemaDialectInfo;
68
110
  //#endregion
69
- export { detectOpenApiVersion as a, isOpenApi30 as c, detectJsonSchemaDraft as i, isOpenApi31 as l, JsonSchemaDraft as n, inferJsonSchemaDraft as o, OpenApiVersionInfo as r, inferJsonSchemaDraftWithReason as s, InferredDraft as t, isSwagger2 as u };
111
+ export { detectJsonSchemaDraft as a, inferJsonSchemaDraftWithReason as c, isSwagger2 as d, matchJsonSchemaDraftUri as f, OpenApiVersionInfo as i, isOpenApi30 as l, JsonSchemaDialectInfo as n, detectOpenApiVersion as o, readJsonSchemaDialect as p, JsonSchemaDraft as r, inferJsonSchemaDraft as s, InferredDraft as t, isOpenApi31 as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schema-components",
3
- "version": "1.18.1",
3
+ "version": "1.20.0",
4
4
  "description": "React components that render UI from Zod schemas, JSON Schema, and OpenAPI documents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",