poe-code 3.0.288 → 3.0.289
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.
package/package.json
CHANGED
|
@@ -1230,7 +1230,12 @@ function resolveEquivalentCompositionSchema(document, schema, operationId, conte
|
|
|
1230
1230
|
const { anyOf: _anyOf, oneOf: _oneOf, ...wrapper } = schema;
|
|
1231
1231
|
void _anyOf;
|
|
1232
1232
|
void _oneOf;
|
|
1233
|
-
|
|
1233
|
+
const enumValues = collectEquivalentCompositionEnumValues(resolved);
|
|
1234
|
+
return {
|
|
1235
|
+
...wrapper,
|
|
1236
|
+
...createSchemaFromEquivalentShape(firstShape),
|
|
1237
|
+
...(enumValues === undefined ? {} : { enum: enumValues })
|
|
1238
|
+
};
|
|
1234
1239
|
}
|
|
1235
1240
|
function getEquivalentSchemaShape(schema) {
|
|
1236
1241
|
if (getCompositionKeyword(schema) !== undefined || Array.isArray(schema.type)) {
|
|
@@ -1250,6 +1255,20 @@ function createSchemaFromEquivalentShape(shape) {
|
|
|
1250
1255
|
}
|
|
1251
1256
|
return { type: "array", items: createSchemaFromEquivalentShape(shape.slice("array:".length)) };
|
|
1252
1257
|
}
|
|
1258
|
+
function collectEquivalentCompositionEnumValues(schemas) {
|
|
1259
|
+
if (schemas.some((schema) => schema.enum === undefined)) {
|
|
1260
|
+
return undefined;
|
|
1261
|
+
}
|
|
1262
|
+
const values = [];
|
|
1263
|
+
for (const schema of schemas) {
|
|
1264
|
+
for (const value of schema.enum ?? []) {
|
|
1265
|
+
if (!values.some((existing) => Object.is(existing, value))) {
|
|
1266
|
+
values.push(value);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
return values.length === 0 ? undefined : values;
|
|
1271
|
+
}
|
|
1253
1272
|
function normalizeNullableTypeArray(schema) {
|
|
1254
1273
|
if (!Array.isArray(schema.type)) {
|
|
1255
1274
|
return schema;
|