@skmtc/core 0.32.0 → 0.32.2

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 (113) hide show
  1. package/esm/parse/v3-1/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -1
  2. package/esm/parse/v3-1/_merge-all-of/check-array-item-type-conflicts.js +7 -3
  3. package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -2
  4. package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  5. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +2 -2
  6. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +8 -12
  7. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  8. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  9. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  10. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  11. package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  12. package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  13. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  14. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  15. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  16. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  17. package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  18. package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  19. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  20. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  21. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +5 -3
  22. package/esm/parse/v3-1/_merge-all-of/merge-union.js +31 -7
  23. package/esm/parse/v3-1/_merge-all-of/merge.d.ts +2 -2
  24. package/esm/parse/v3-1/_merge-all-of/merge.js +28 -23
  25. package/esm/parse/v3-1/_merge-all-of/types.d.ts +6 -0
  26. package/esm/parse/v3-1/schema/normalize-schema-shape.d.ts +24 -0
  27. package/esm/parse/v3-1/schema/normalize-schema-shape.js +213 -0
  28. package/esm/parse/v3-1/schema/toSchemasV3.js +49 -156
  29. package/esm/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -1
  30. package/esm/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.js +7 -3
  31. package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -2
  32. package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  33. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +2 -2
  34. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +8 -12
  35. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  36. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  37. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  38. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  39. package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  40. package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  41. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  42. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  43. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  44. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  45. package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  46. package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  47. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  48. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  49. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +5 -3
  50. package/esm/parse/v3-2/_merge-all-of/merge-union.js +31 -7
  51. package/esm/parse/v3-2/_merge-all-of/merge.d.ts +2 -2
  52. package/esm/parse/v3-2/_merge-all-of/merge.js +28 -23
  53. package/esm/parse/v3-2/_merge-all-of/types.d.ts +6 -0
  54. package/esm/parse/v3-2/schema/normalize-schema-shape.d.ts +24 -0
  55. package/esm/parse/v3-2/schema/normalize-schema-shape.js +213 -0
  56. package/esm/parse/v3-2/schema/toSchemasV3.js +49 -156
  57. package/package.json +1 -1
  58. package/script/parse/v3-1/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -1
  59. package/script/parse/v3-1/_merge-all-of/check-array-item-type-conflicts.js +7 -3
  60. package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -2
  61. package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  62. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +2 -2
  63. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +8 -12
  64. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  65. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  66. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  67. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  68. package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  69. package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  70. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  71. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  72. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  73. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  74. package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  75. package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  76. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  77. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  78. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +5 -3
  79. package/script/parse/v3-1/_merge-all-of/merge-union.js +31 -7
  80. package/script/parse/v3-1/_merge-all-of/merge.d.ts +2 -2
  81. package/script/parse/v3-1/_merge-all-of/merge.js +28 -23
  82. package/script/parse/v3-1/_merge-all-of/types.d.ts +6 -0
  83. package/script/parse/v3-1/schema/normalize-schema-shape.d.ts +24 -0
  84. package/script/parse/v3-1/schema/normalize-schema-shape.js +219 -0
  85. package/script/parse/v3-1/schema/toSchemasV3.js +50 -157
  86. package/script/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -1
  87. package/script/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.js +7 -3
  88. package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -2
  89. package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  90. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +2 -2
  91. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +8 -12
  92. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  93. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  94. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  95. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  96. package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  97. package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  98. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  99. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  100. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  101. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  102. package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  103. package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  104. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  105. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  106. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +5 -3
  107. package/script/parse/v3-2/_merge-all-of/merge-union.js +31 -7
  108. package/script/parse/v3-2/_merge-all-of/merge.d.ts +2 -2
  109. package/script/parse/v3-2/_merge-all-of/merge.js +28 -23
  110. package/script/parse/v3-2/_merge-all-of/types.d.ts +6 -0
  111. package/script/parse/v3-2/schema/normalize-schema-shape.d.ts +24 -0
  112. package/script/parse/v3-2/schema/normalize-schema-shape.js +219 -0
  113. package/script/parse/v3-2/schema/toSchemasV3.js +50 -157
@@ -15,6 +15,7 @@ const refFns_js_2 = require("../../../helpers/refFns.js");
15
15
  const merge_intersection_js_1 = require("../_merge-all-of/merge-intersection.js");
16
16
  const merge_union_js_1 = require("../_merge-all-of/merge-union.js");
17
17
  const tryParseAt_js_1 = require("../../../context/tryParseAt.js");
18
+ const normalize_schema_shape_js_1 = require("./normalize-schema-shape.js");
18
19
  const toSchemasV3 = ({ schemas, stackTrail, context }) => {
19
20
  const output = {};
20
21
  const entries = Object.entries(schemas);
@@ -42,161 +43,32 @@ const toOptionalSchemasV3 = ({ schemas, stackTrail, context }) => {
42
43
  };
43
44
  exports.toOptionalSchemasV3 = toOptionalSchemasV3;
44
45
  /**
45
- * OpenAPI 3.1 lets a schema's `type` be an ARRAY (e.g. `['string', 'null']`),
46
- * which the shared IR — modelling a single `type` plus a `nullable` flag —
47
- * does not. Normalize the array form into shapes the rest of the dispatcher
48
- * already understands:
49
- *
50
- * - `['T', 'null']` (one non-null type) → `{ type: 'T', nullable: true }`
51
- * - `['T1', 'T2', …]` (several non-null) → a `oneOf` of the bare types,
52
- * i.e. the 3.1 multi-type union. 3.0 cannot express this — it is the
53
- * CASE-2 gap where the v3-0 parser degrades to OasUnknown.
54
- * - `['null']` (only null) → left unchanged → OasUnknown,
55
- * since there is no first-class OasNull IR node yet (a documented gap).
56
- *
57
- * The hoisted `nullable` flag is the IR's representation of nullability; the
58
- * leaf parsers read it via `parseNullable`. A non-array `type` passes through.
59
- */
60
- const normalizeTypeArray = (schema) => {
61
- const rawType = schema.type;
62
- if (!Array.isArray(rawType)) {
63
- return schema;
64
- }
65
- const members = rawType.filter(member => member !== 'null');
66
- const nullable = rawType.length !== members.length || schema.nullable;
67
- // Only `null` (`type: ['null']`): no OasNull node yet — fall through.
68
- if (members.length === 0) {
69
- return schema;
70
- }
71
- // Several non-null types: a 3.1 multi-type union. Model it as a `oneOf`
72
- // of the bare types and let the oneOf branch build the OasUnion.
73
- if (members.length > 1) {
74
- const { type: _type, ...rest } = schema;
75
- return { ...rest, nullable, oneOf: members.map(member => ({ type: member })) };
76
- }
77
- // Exactly one non-null type: dispatch as that type, carrying nullability.
78
- switch (members[0]) {
79
- case 'object':
80
- case 'integer':
81
- case 'number':
82
- case 'boolean':
83
- case 'string':
84
- return { ...schema, type: members[0], nullable };
85
- case 'array':
86
- return 'items' in schema ? { ...schema, type: members[0], nullable } : schema;
87
- default:
88
- return schema;
89
- }
90
- };
91
- /**
92
- * OpenAPI 3.1 `const: X` is the single-value form of `enum` (3.0 expresses a
93
- * literal as a one-element `enum`). Rewrite it so the existing enum-aware leaf
94
- * parsers handle it; matches down-convert's `convertConstToEnum`, so a 3.0
95
- * `enum:[X]` and a 3.1 `const:X` land on the same IR.
96
- */
97
- const normalizeConst = (schema) => {
98
- if (!('const' in schema)) {
99
- return schema;
100
- }
101
- // `const` is a 3.1 keyword the 3.0-typed SchemaObject does not model; read
102
- // it via an annotated destructure rather than a cast.
103
- const { const: constValue, ...rest } = schema;
104
- return { ...rest, enum: [constValue] };
105
- };
106
- /**
107
- * OpenAPI 3.1 schemas carry `examples` (an array, JSON Schema 2020-12); 3.0
108
- * and the IR use a single `example`. Adopt the first array element as the IR
109
- * `example` when no singular `example` is set, and drop the array. Matches
110
- * down-convert's `convertJsonSchemaExamples`.
111
- */
112
- const normalizeExamples = (schema) => {
113
- if ('example' in schema || !('examples' in schema)) {
114
- return schema;
115
- }
116
- // `examples` is a 3.1 keyword the 3.0-typed SchemaObject does not model.
117
- const { examples, ...rest } = schema;
118
- if (!Array.isArray(examples) || examples.length === 0) {
119
- return rest;
120
- }
121
- return { ...rest, example: examples[0] };
122
- };
123
- /**
124
- * OpenAPI 3.1 expresses exclusive bounds as NUMBERS (`exclusiveMinimum: 5`
125
- * means "> 5"); the shared IR (and 3.0) model them as a boolean flag paired
126
- * with `minimum`/`maximum`. Convert the numeric form so the number/integer
127
- * leaves validate. Matches down-convert's `convertExclusiveMinMax`, so a 3.0
128
- * `{minimum:5, exclusiveMinimum:true}` and a 3.1 `{exclusiveMinimum:5}` land
129
- * on the same IR.
46
+ * Remove `unevaluatedProperties` from an `allOf`/`oneOf`/`anyOf` wrapper and
47
+ * log it as skipped. Left in place, it would be renamed to
48
+ * `additionalProperties` when the merged or collapsed schema is dispatched
49
+ * again with no composition keyword left.
130
50
  */
131
- const normalizeExclusiveBounds = (schema) => {
132
- // `exclusiveMinimum`/`exclusiveMaximum` are 3.0-typed boolean here; in 3.1
133
- // they arrive as numbers, so read them loosely.
134
- const exclusiveMinimum = schema.exclusiveMinimum;
135
- const exclusiveMaximum = schema.exclusiveMaximum;
136
- if (typeof exclusiveMinimum !== 'number' && typeof exclusiveMaximum !== 'number') {
51
+ const withoutWrapperUnevaluatedProperties = ({ schema, parentType, stackTrail, context }) => {
52
+ if (!('unevaluatedProperties' in schema)) {
137
53
  return schema;
138
54
  }
139
- const next = { ...schema };
140
- if (typeof exclusiveMinimum === 'number') {
141
- next.minimum = exclusiveMinimum;
142
- next.exclusiveMinimum = true;
143
- }
144
- if (typeof exclusiveMaximum === 'number') {
145
- next.maximum = exclusiveMaximum;
146
- next.exclusiveMaximum = true;
147
- }
148
- return next;
149
- };
150
- /**
151
- * OpenAPI 3.1 / JSON Schema 2020-12 expresses a binary string payload with
152
- * `contentMediaType: 'application/octet-stream'` and base64 with
153
- * `contentEncoding: 'base64'`; the shared IR (and 3.0) carry these as a string
154
- * `format` (`binary` / `byte`, both in the format allow-list). Map them so the
155
- * format reaches the IR. Mirrors down-convert's
156
- * `convertJsonSchemaContentMediaType` / `convertJsonSchemaContentEncoding`:
157
- * string schemas only, and a pre-existing (conflicting) `format` wins — the
158
- * content keyword is dropped, not overwritten. Without this, retiring
159
- * down-convert would silently lose the `format` signal on 3.1 binary uploads.
160
- */
161
- const normalizeContentFormat = (schema) => {
162
- if (schema.type !== 'string') {
163
- return schema;
164
- }
165
- // `contentMediaType`/`contentEncoding` are 3.1 keywords the 3.0-typed
166
- // SchemaObject does not model; read them loosely.
167
- const view = schema;
168
- const derivedFormat = view.contentMediaType === 'application/octet-stream'
169
- ? 'binary'
170
- : view.contentEncoding === 'base64'
171
- ? 'byte'
172
- : undefined;
173
- if (derivedFormat === undefined) {
174
- return schema;
175
- }
176
- const { contentMediaType: _contentMediaType, contentEncoding: _contentEncoding, ...rest } = view;
177
- return 'format' in rest ? rest : { ...rest, format: derivedFormat };
178
- };
179
- /**
180
- * Map the 3.1-only schema-shape encodings onto the shared IR shape before
181
- * dispatching: type arrays, `const`, `examples[]`, numeric exclusive bounds,
182
- * and binary/base64 content keywords. Each step returns its input unchanged
183
- * when it does not apply, so the composed result is referentially equal to
184
- * `schema` when nothing matched — letting the dispatcher re-dispatch only when
185
- * needed.
186
- */
187
- const normalizeSchemaShape = (schema) => {
188
- return normalizeExclusiveBounds(normalizeExamples(normalizeConst(normalizeContentFormat(normalizeTypeArray(schema)))));
55
+ const { unevaluatedProperties, ...rest } = schema;
56
+ context.logSkippedFields({
57
+ skipped: { unevaluatedProperties },
58
+ parent: schema,
59
+ parentType,
60
+ stackTrail
61
+ });
62
+ return rest;
189
63
  };
190
64
  /**
191
- * Is this a 3.1 `{ type: 'null' }` schema member? (`'null'` is a 3.1 type
192
- * literal the 3.0-typed SchemaObject does not model, so read it loosely.)
65
+ * Is this a 3.1 null-only schema member (`type: 'null'` or `['null']`)?
193
66
  */
194
67
  const isNullTypeSchema = (member) => {
195
68
  if ((0, refFns_js_1.isRef)(member)) {
196
69
  return false;
197
70
  }
198
- const type = member.type;
199
- return type === 'null';
71
+ return (0, normalize_schema_shape_js_1.isNullOnlyType)(member.type);
200
72
  };
201
73
  /**
202
74
  * Split `oneOf`/`anyOf` members into the non-null members plus whether a
@@ -252,11 +124,17 @@ const toSchemaV3 = ({ schema, stackTrail, context }) => {
252
124
  if ('not' in schema) {
253
125
  throw new Error('Schema uses unsupported "not" keyword');
254
126
  }
255
- const normalized = normalizeSchemaShape(schema);
127
+ const normalized = (0, normalize_schema_shape_js_1.normalizeSchemaShape)(schema);
256
128
  if (normalized !== schema) {
257
129
  return (0, exports.toSchemaV3)({ schema: normalized, stackTrail, context });
258
130
  }
259
131
  if ('allOf' in schema && Array.isArray(schema.allOf)) {
132
+ const wrapper = withoutWrapperUnevaluatedProperties({
133
+ schema,
134
+ parentType: 'allOf',
135
+ stackTrail,
136
+ context
137
+ });
260
138
  return stackTrail.trace('allOf', st => {
261
139
  // A single-member allOf collapses to its sole member — the value must
262
140
  // satisfy exactly that one schema. When the member is a `$ref`, keep it
@@ -266,7 +144,7 @@ const toSchemaV3 = ({ schema, stackTrail, context }) => {
266
144
  // self-referential, and eagerly resolving it would not terminate. The
267
145
  // ref resolves at use time like every other ref. Mirrors the
268
146
  // single-member oneOf/anyOf handling below.
269
- const { allOf, ...value } = schema;
147
+ const { allOf, ...value } = wrapper;
270
148
  const members = allOf ?? [];
271
149
  if (members.length === 1) {
272
150
  const [member] = members;
@@ -286,23 +164,31 @@ const toSchemaV3 = ({ schema, stackTrail, context }) => {
286
164
  });
287
165
  }
288
166
  const merged = (0, merge_intersection_js_1.mergeIntersection)({
289
- schema,
290
- getRef: (0, refFns_js_2.toGetRef)(context.documentObject)
167
+ schema: wrapper,
168
+ getRef: (0, refFns_js_2.toGetRef)(context.documentObject),
169
+ normalize: normalize_schema_shape_js_1.normalizeMergeMember
291
170
  });
292
171
  return (0, exports.toSchemaV3)({ schema: merged, stackTrail: st, context });
293
172
  });
294
173
  }
295
174
  if ('oneOf' in schema && Array.isArray(schema.oneOf)) {
175
+ const wrapper = withoutWrapperUnevaluatedProperties({
176
+ schema,
177
+ parentType: 'oneOf',
178
+ stackTrail,
179
+ context
180
+ });
296
181
  return stackTrail.trace('oneOf', st => {
297
182
  // 3.1: a `{ type: 'null' }` member makes the union nullable. Fold it
298
183
  // into a `nullable` flag the collapse/union logic already understands.
299
- const { members: oneOfWithoutNull, nullable: hasNullMember } = partitionNullMember(schema.oneOf ?? []);
184
+ const { members: oneOfWithoutNull, nullable: hasNullMember } = partitionNullMember(wrapper.oneOf ?? []);
300
185
  const withoutNull = hasNullMember
301
- ? { ...schema, oneOf: oneOfWithoutNull, nullable: true }
302
- : schema;
186
+ ? { ...wrapper, oneOf: oneOfWithoutNull, nullable: true }
187
+ : wrapper;
303
188
  const merged = (0, merge_union_js_1.mergeUnion)({
304
189
  schema: withoutNull,
305
190
  getRef: (0, refFns_js_2.toGetRef)(context.documentObject),
191
+ normalize: normalize_schema_shape_js_1.normalizeMergeMember,
306
192
  groupType: 'oneOf'
307
193
  });
308
194
  if (!('oneOf' in merged) || !Array.isArray(merged.oneOf)) {
@@ -342,22 +228,29 @@ const toSchemaV3 = ({ schema, stackTrail, context }) => {
342
228
  });
343
229
  }
344
230
  if ('anyOf' in schema && Array.isArray(schema.anyOf)) {
231
+ const wrapper = withoutWrapperUnevaluatedProperties({
232
+ schema,
233
+ parentType: 'anyOf',
234
+ stackTrail,
235
+ context
236
+ });
345
237
  return stackTrail.trace('anyOf', st => {
346
238
  // deno-lint-ignore ban-ts-comment
347
239
  // @ts-expect-error
348
- if (schema['x-expansionResources'] && Array.isArray(schema.anyOf)) {
349
- const { anyOf, ...value } = schema;
240
+ if (wrapper['x-expansionResources'] && Array.isArray(wrapper.anyOf)) {
241
+ const { anyOf, ...value } = wrapper;
350
242
  return (0, toUnion_js_1.toUnion)({ value, members: anyOf, parentType: 'anyOf', stackTrail: st, context });
351
243
  }
352
244
  // 3.1: a `{ type: 'null' }` member makes the union nullable (mirrors
353
245
  // the oneOf branch above).
354
- const { members: anyOfWithoutNull, nullable: hasNullMember } = partitionNullMember(schema.anyOf ?? []);
246
+ const { members: anyOfWithoutNull, nullable: hasNullMember } = partitionNullMember(wrapper.anyOf ?? []);
355
247
  const withoutNull = hasNullMember
356
- ? { ...schema, anyOf: anyOfWithoutNull, nullable: true }
357
- : schema;
248
+ ? { ...wrapper, anyOf: anyOfWithoutNull, nullable: true }
249
+ : wrapper;
358
250
  const merged = (0, merge_union_js_1.mergeUnion)({
359
251
  schema: withoutNull,
360
252
  getRef: (0, refFns_js_2.toGetRef)(context.documentObject),
253
+ normalize: normalize_schema_shape_js_1.normalizeMergeMember,
361
254
  groupType: 'anyOf'
362
255
  });
363
256
  if (!('anyOf' in merged) || !Array.isArray(merged.anyOf)) {