@thymian/core 0.2.1-canary.20260912-d2cf229 → 0.2.1-canary.20260914-e32cebc

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 (58) hide show
  1. package/dist/http-testing/deserialize/items.d.ts +11 -0
  2. package/dist/http-testing/deserialize/items.d.ts.map +1 -0
  3. package/dist/http-testing/deserialize/items.js +99 -0
  4. package/dist/http-testing/deserialize/items.js.map +1 -0
  5. package/dist/http-testing/deserialize/result.d.ts +54 -0
  6. package/dist/http-testing/deserialize/result.d.ts.map +1 -0
  7. package/dist/http-testing/deserialize/result.js +43 -0
  8. package/dist/http-testing/deserialize/result.js.map +1 -0
  9. package/dist/http-testing/deserialize/schema.d.ts +54 -0
  10. package/dist/http-testing/deserialize/schema.d.ts.map +1 -0
  11. package/dist/http-testing/deserialize/schema.js +447 -0
  12. package/dist/http-testing/deserialize/schema.js.map +1 -0
  13. package/dist/http-testing/deserialize/split.d.ts +28 -0
  14. package/dist/http-testing/deserialize/split.d.ts.map +1 -0
  15. package/dist/http-testing/deserialize/split.js +82 -0
  16. package/dist/http-testing/deserialize/split.js.map +1 -0
  17. package/dist/http-testing/deserialize/style/form.d.ts +19 -0
  18. package/dist/http-testing/deserialize/style/form.d.ts.map +1 -0
  19. package/dist/http-testing/deserialize/style/form.js +45 -0
  20. package/dist/http-testing/deserialize/style/form.js.map +1 -0
  21. package/dist/http-testing/deserialize/style/header.d.ts +10 -0
  22. package/dist/http-testing/deserialize/style/header.d.ts.map +1 -0
  23. package/dist/http-testing/deserialize/style/header.js +21 -0
  24. package/dist/http-testing/deserialize/style/header.js.map +1 -0
  25. package/dist/http-testing/deserialize/style/path.d.ts +5 -0
  26. package/dist/http-testing/deserialize/style/path.d.ts.map +1 -0
  27. package/dist/http-testing/deserialize/style/path.js +134 -0
  28. package/dist/http-testing/deserialize/style/path.js.map +1 -0
  29. package/dist/http-testing/deserialize/style/simple.d.ts +51 -0
  30. package/dist/http-testing/deserialize/style/simple.d.ts.map +1 -0
  31. package/dist/http-testing/deserialize/style/simple.js +76 -0
  32. package/dist/http-testing/deserialize/style/simple.js.map +1 -0
  33. package/dist/http-testing/deserialize-parameter.d.ts +37 -0
  34. package/dist/http-testing/deserialize-parameter.d.ts.map +1 -0
  35. package/dist/http-testing/deserialize-parameter.js +37 -0
  36. package/dist/http-testing/deserialize-parameter.js.map +1 -0
  37. package/dist/http-testing/index.d.ts +1 -0
  38. package/dist/http-testing/index.d.ts.map +1 -1
  39. package/dist/http-testing/index.js +1 -0
  40. package/dist/http-testing/index.js.map +1 -1
  41. package/dist/http-testing/validate/validate-deserialized.d.ts +17 -0
  42. package/dist/http-testing/validate/validate-deserialized.d.ts.map +1 -0
  43. package/dist/http-testing/validate/validate-deserialized.js +53 -0
  44. package/dist/http-testing/validate/validate-deserialized.js.map +1 -0
  45. package/dist/http-testing/validate/validate-headers.d.ts.map +1 -1
  46. package/dist/http-testing/validate/validate-headers.js +9 -21
  47. package/dist/http-testing/validate/validate-headers.js.map +1 -1
  48. package/dist/http-testing/validate/validate-request-headers.d.ts.map +1 -1
  49. package/dist/http-testing/validate/validate-request-headers.js +9 -21
  50. package/dist/http-testing/validate/validate-request-headers.js.map +1 -1
  51. package/dist/http-testing/validate/validate-request-path-parameters.d.ts.map +1 -1
  52. package/dist/http-testing/validate/validate-request-path-parameters.js +22 -23
  53. package/dist/http-testing/validate/validate-request-path-parameters.js.map +1 -1
  54. package/dist/http-testing/validate/validate-request-query-parameters.d.ts +21 -3
  55. package/dist/http-testing/validate/validate-request-query-parameters.d.ts.map +1 -1
  56. package/dist/http-testing/validate/validate-request-query-parameters.js +251 -42
  57. package/dist/http-testing/validate/validate-request-query-parameters.js.map +1 -1
  58. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import type { ThymianSchema } from '../../format/thymian-schema.js';
2
+ import { type DeserializedParameter } from './result.js';
3
+ export declare function deserializeObjectEntries(entries: [string, string | string[]][], schema: ThymianSchema | undefined, root: ThymianSchema | undefined): Record<string, unknown>;
4
+ /**
5
+ * Shared typing step. `items` is the already-split, already-decoded list of
6
+ * scalar wire strings for one parameter; `raw` is the value to fall back to
7
+ * when the wire form is malformed for the declared type, so the schema — not
8
+ * this module — gets to report it.
9
+ */
10
+ export declare function deserializeItems(items: string[], raw: string | string[], schema: ThymianSchema | undefined, explode: boolean): DeserializedParameter;
11
+ //# sourceMappingURL=items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../src/http-testing/deserialize/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAgB,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA4BvE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,EACtC,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,IAAI,EAAE,aAAa,GAAG,SAAS,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2BzB;AA0BD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EACtB,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,OAAO,EAAE,OAAO,GACf,qBAAqB,CAkDvB"}
@@ -0,0 +1,99 @@
1
+ import { deserialized } from './result.js';
2
+ import { deserializeScalar, itemSchema, propertySchema, schemaTypes, structuralKind, } from './schema.js';
3
+ /**
4
+ * The typing step, shared by every style.
5
+ *
6
+ * By the time this runs the style has already been reversed: `items` is the
7
+ * list of scalar wire strings, and `raw` is the text the client sent with its
8
+ * style packaging removed. This decides only what those strings mean —
9
+ * array, object or scalar — and converts them.
10
+ */
11
+ function deserializeArrayItems(items, schema, root) {
12
+ return items.map((item, index) => deserializeScalar(item, itemSchema(schema, root, index), root));
13
+ }
14
+ export function deserializeObjectEntries(entries, schema, root) {
15
+ const result = {};
16
+ for (const [key, raw] of entries) {
17
+ const property = propertySchema(schema, root, key);
18
+ const types = schemaTypes(property, root);
19
+ const value = Array.isArray(raw) ||
20
+ (types.includes('array') && !types.includes('string'))
21
+ ? deserializeArrayItems(Array.isArray(raw) ? raw : [raw], property, root)
22
+ : deserializeScalar(raw, property, root);
23
+ // `result[key] = …` would invoke the `__proto__` setter, replacing the
24
+ // prototype and silently dropping the property instead of validating it.
25
+ Object.defineProperty(result, key, {
26
+ value,
27
+ enumerable: true,
28
+ writable: true,
29
+ configurable: true,
30
+ });
31
+ }
32
+ return result;
33
+ }
34
+ /** Pair up a flat `k,v,k,v` list. A dangling key means the value is malformed. */
35
+ function pairs(flat) {
36
+ if (flat.length % 2 !== 0) {
37
+ return undefined;
38
+ }
39
+ // A key carrying `=` means the value arrived in the EXPLODED form
40
+ // (`role=admin,lvl=3`) while its description says otherwise. Pairing it up
41
+ // would invent the property `"role=admin"` and quietly validate.
42
+ for (let index = 0; index < flat.length; index += 2) {
43
+ if (flat[index].includes('=')) {
44
+ return undefined;
45
+ }
46
+ }
47
+ const result = [];
48
+ for (let index = 0; index + 1 < flat.length; index += 2) {
49
+ result.push([flat[index], flat[index + 1]]);
50
+ }
51
+ return result;
52
+ }
53
+ /**
54
+ * Shared typing step. `items` is the already-split, already-decoded list of
55
+ * scalar wire strings for one parameter; `raw` is the value to fall back to
56
+ * when the wire form is malformed for the declared type, so the schema — not
57
+ * this module — gets to report it.
58
+ */
59
+ export function deserializeItems(items, raw, schema, explode) {
60
+ const types = schemaTypes(schema, schema);
61
+ const kind = structuralKind(schema);
62
+ // `string` wins over every structural interpretation, exactly as in
63
+ // deserializeScalar: a description that accepts a string accepts this value.
64
+ // Unless the value genuinely arrived as several occurrences and the schema
65
+ // also allows an array — then no single string could ever represent it.
66
+ if (types.includes('string') &&
67
+ !(Array.isArray(raw) && types.includes('array'))) {
68
+ return deserialized(raw);
69
+ }
70
+ if (kind === 'array') {
71
+ return deserialized(deserializeArrayItems(items, schema, schema));
72
+ }
73
+ if (kind === 'object') {
74
+ const entries = explode && items.every((segment) => segment.includes('='))
75
+ ? items.map((segment) => {
76
+ const separator = segment.indexOf('=');
77
+ return [segment.slice(0, separator), segment.slice(separator + 1)];
78
+ })
79
+ : explode
80
+ ? // A segment without `=` is not a valid exploded object form;
81
+ // refuse to repair it, exactly as `pairs()` refuses a dangling key.
82
+ undefined
83
+ : pairs(items);
84
+ // A malformed object form (a dangling key) must not be quietly repaired
85
+ // into a valid object; hand the raw value to the schema instead.
86
+ if (!entries) {
87
+ return deserialized(raw);
88
+ }
89
+ return deserialized(deserializeObjectEntries(entries, schema, schema));
90
+ }
91
+ // A scalar parameter sent more than once is parameter pollution — a real
92
+ // client defect. Handing the whole list to the schema keeps it reported,
93
+ // as it was before deserialization existed.
94
+ if (items.length > 1) {
95
+ return deserialized(items);
96
+ }
97
+ return deserialized(deserializeScalar(items[0] ?? '', schema, schema));
98
+ }
99
+ //# sourceMappingURL=items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"items.js","sourceRoot":"","sources":["../../../src/http-testing/deserialize/items.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAA8B,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AAErB;;;;;;;GAOG;AAEH,SAAS,qBAAqB,CAC5B,KAAe,EACf,MAAiC,EACjC,IAA+B;IAE/B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAC/B,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAsC,EACtC,MAAiC,EACjC,IAA+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CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAoB,EAAE;gBACtC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBAEvC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;YACrE,CAAC,CAAC;YACJ,CAAC,CAAC,OAAO;gBACP,CAAC,CAAC,6DAA6D;oBAC7D,oEAAoE;oBACpE,SAAS;gBACX,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAErB,wEAAwE;QACxE,iEAAiE;QACjE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QAED,OAAO,YAAY,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,yEAAyE;IACzE,yEAAyE;IACzE,4CAA4C;IAC5C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,YAAY,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { SerializationStyle, Style } from '../../format/serialization-style/index.js';
2
+ /**
3
+ * A wire value that was not deserialized. Two distinct situations, deliberately
4
+ * kept apart because they blame different parties:
5
+ *
6
+ * - `malformed: false` — **thymian's** limitation. It cannot reverse this
7
+ * style, so the value went unchecked. Reported as `info`; the request may be
8
+ * perfectly correct.
9
+ * - `malformed: true` — the **request's** defect. thymian can reverse this
10
+ * style, and this value is not in it. Reported as an `assertion-failure`,
11
+ * because a value not serialized per its description does not conform to it.
12
+ */
13
+ export interface UnsupportedSerialization {
14
+ supported: false;
15
+ style: Style;
16
+ explode: boolean;
17
+ malformed?: boolean;
18
+ }
19
+ export interface DeserializedParameter {
20
+ supported: true;
21
+ value: unknown;
22
+ }
23
+ export type DeserializeResult = DeserializedParameter | UnsupportedSerialization;
24
+ export declare function unsupported({ style, explode, }: SerializationStyle): UnsupportedSerialization;
25
+ /** The style is reversible; this particular value is not in it. */
26
+ export declare function malformed({ style, explode, }: SerializationStyle): UnsupportedSerialization;
27
+ export declare function deserialized(value: unknown): DeserializedParameter;
28
+ /**
29
+ * The message used wherever a parameter's declared style is one thymian cannot
30
+ * deserialize. Reported as `info`, not a failure: the request may well be
31
+ * correct — thymian simply did not check it — and blaming the request for a
32
+ * tool limitation is the very defect this module exists to remove.
33
+ */
34
+ export declare function unsupportedStyleMessage(subject: string, { style, explode }: UnsupportedSerialization): string;
35
+ /**
36
+ * The message for a value whose style thymian DOES reverse, but whose wire
37
+ * form it could not reconstruct — a nested `deepObject` key (`filter[a][b]`),
38
+ * which OpenAPI's style table leaves undefined.
39
+ *
40
+ * Reported as `info` like `unsupportedStyleMessage`, and deliberately NOT
41
+ * worded like it: saying thymian "cannot deserialize deepObject" when it
42
+ * demonstrably can blames a supported style for a shape the description never
43
+ * defined, which is the same misattribution this module exists to remove.
44
+ * Not `malformedStyleMessage` either — a form OpenAPI leaves undefined is not
45
+ * a request that violates its description, so it is not an assertion failure.
46
+ */
47
+ export declare function unreconstructableValueMessage(subject: string, style: Style): string;
48
+ /**
49
+ * The message for a value that is not serialized in the style its description
50
+ * declares. Unlike `unsupportedStyleMessage` this is an assertion failure: the
51
+ * description says how the value must be encoded, and it is not.
52
+ */
53
+ export declare function malformedStyleMessage(subject: string, { style, explode }: UnsupportedSerialization): string;
54
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../src/http-testing/deserialize/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACN,MAAM,2CAA2C,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,KAAK,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,iBAAiB,GAC3B,qBAAqB,GAAG,wBAAwB,CAAC;AAEnD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,GACR,EAAE,kBAAkB,GAAG,wBAAwB,CAE/C;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,OAAO,GACR,EAAE,kBAAkB,GAAG,wBAAwB,CAE/C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,wBAAwB,GAC3C,MAAM,CAER;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,GACX,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,wBAAwB,GAC3C,MAAM,CAER"}
@@ -0,0 +1,43 @@
1
+ export function unsupported({ style, explode, }) {
2
+ return { supported: false, style, explode };
3
+ }
4
+ /** The style is reversible; this particular value is not in it. */
5
+ export function malformed({ style, explode, }) {
6
+ return { supported: false, style, explode, malformed: true };
7
+ }
8
+ export function deserialized(value) {
9
+ return { supported: true, value };
10
+ }
11
+ /**
12
+ * The message used wherever a parameter's declared style is one thymian cannot
13
+ * deserialize. Reported as `info`, not a failure: the request may well be
14
+ * correct — thymian simply did not check it — and blaming the request for a
15
+ * tool limitation is the very defect this module exists to remove.
16
+ */
17
+ export function unsupportedStyleMessage(subject, { style, explode }) {
18
+ return `${subject} uses serialization style "${style}" (explode: ${explode}), which thymian cannot deserialize yet — it was not validated against its schema.`;
19
+ }
20
+ /**
21
+ * The message for a value whose style thymian DOES reverse, but whose wire
22
+ * form it could not reconstruct — a nested `deepObject` key (`filter[a][b]`),
23
+ * which OpenAPI's style table leaves undefined.
24
+ *
25
+ * Reported as `info` like `unsupportedStyleMessage`, and deliberately NOT
26
+ * worded like it: saying thymian "cannot deserialize deepObject" when it
27
+ * demonstrably can blames a supported style for a shape the description never
28
+ * defined, which is the same misattribution this module exists to remove.
29
+ * Not `malformedStyleMessage` either — a form OpenAPI leaves undefined is not
30
+ * a request that violates its description, so it is not an assertion failure.
31
+ */
32
+ export function unreconstructableValueMessage(subject, style) {
33
+ return `${subject} is declared with serialization style "${style}" but arrived in a form that style does not define — it was not validated against its schema.`;
34
+ }
35
+ /**
36
+ * The message for a value that is not serialized in the style its description
37
+ * declares. Unlike `unsupportedStyleMessage` this is an assertion failure: the
38
+ * description says how the value must be encoded, and it is not.
39
+ */
40
+ export function malformedStyleMessage(subject, { style, explode }) {
41
+ return `${subject} is not serialized in its declared style "${style}" (explode: ${explode}).`;
42
+ }
43
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/http-testing/deserialize/result.ts"],"names":[],"mappings":"AA+BA,MAAM,UAAU,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,GACY;IACnB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC9C,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,OAAO,GACY;IACnB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,EAAE,KAAK,EAAE,OAAO,EAA4B;IAE5C,OAAO,GAAG,OAAO,8BAA8B,KAAK,eAAe,OAAO,oFAAoF,CAAC;AACjK,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAe,EACf,KAAY;IAEZ,OAAO,GAAG,OAAO,0CAA0C,KAAK,+FAA+F,CAAC;AAClK,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAe,EACf,EAAE,KAAK,EAAE,OAAO,EAA4B;IAE5C,OAAO,GAAG,OAAO,6CAA6C,KAAK,eAAe,OAAO,IAAI,CAAC;AAChG,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { ThymianSchema, ThymianSchemaType } from '../../format/thymian-schema.js';
2
+ export declare function isSchema(value: unknown): value is ThymianSchema;
3
+ /**
4
+ * Flatten `$ref` and `allOf` so the structural keywords this module reads
5
+ * (`items`, `properties`, …) are visible on one object.
6
+ */
7
+ export declare function flattenSchema(schema: ThymianSchema | undefined, root: ThymianSchema, depth?: number): ThymianSchema | undefined;
8
+ /**
9
+ * The effective types of a schema, seen through `$ref`, `allOf`, `anyOf`,
10
+ * `oneOf`, `enum` and `const`. A schema carrying none of these yields `[]`,
11
+ * which means "do not convert".
12
+ *
13
+ * Exported because every structural decision — whether a wire value is a
14
+ * delimited list, whether an object parameter needs folding — must ask the
15
+ * same resolving question. A second, non-resolving copy of this logic is how
16
+ * `$ref`ed parameters slipped through once already.
17
+ */
18
+ export declare function schemaTypes(schema: ThymianSchema | undefined, root?: ThymianSchema, depth?: number): ThymianSchemaType[];
19
+ /**
20
+ * The schema governing array item `index`. `prefixItems` governs the leading
21
+ * positions and `items` only the remainder, so prefix entries take precedence.
22
+ * `contains` is deliberately NOT used: it is existential ("at least one item
23
+ * matches"), not a per-item constraint.
24
+ */
25
+ export declare function itemSchema(schema: ThymianSchema | undefined, root: ThymianSchema | undefined, index: number): ThymianSchema | undefined;
26
+ /** The schema governing object property `key`, through `properties`/`patternProperties`/`additionalProperties`. */
27
+ export declare function propertySchema(schema: ThymianSchema | undefined, root: ThymianSchema | undefined, key: string): ThymianSchema | undefined;
28
+ /** The `enum` of a schema, seen through `$ref`/`allOf`. */
29
+ export declare function enumMembers(schema: ThymianSchema | undefined, root: ThymianSchema | undefined): unknown[] | undefined;
30
+ /**
31
+ * Convert a single wire string to the scalar type its schema declares.
32
+ * Returns `wire` unchanged when the value is not a valid lexical form of any
33
+ * declared type — that is what keeps `?year=abc` failing on `must be integer`
34
+ * rather than silently becoming `NaN`.
35
+ */
36
+ export declare function deserializeScalar(wire: string, schema: ThymianSchema | undefined, root?: ThymianSchema): unknown;
37
+ /**
38
+ * Whether a wire value is a delimited list, and of what — the single accessor
39
+ * every shape decision asks, so splitting and typing can never disagree.
40
+ *
41
+ * A schema often omits `type` while still being unambiguously structured:
42
+ * `{ properties: {...}, required: [...] }` is an object, `{ items: {...} }` is
43
+ * an array. Requiring a literal `type` made those look like scalars, so the
44
+ * value was never split and `properties`/`items` never applied — a violation
45
+ * passed clean. Structural keywords therefore count as evidence of shape.
46
+ *
47
+ * `string` still wins over everything: a description that accepts a string
48
+ * accepts the value whole, and must never see it torn apart on a delimiter it
49
+ * legitimately contains.
50
+ */
51
+ export declare function structuralKind(schema: ThymianSchema | undefined, root?: ThymianSchema): 'array' | 'object' | undefined;
52
+ /** Types that make the wire value a delimited list rather than one scalar. */
53
+ export declare function isStructural(schema: ThymianSchema | undefined): boolean;
54
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+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