vovk 3.0.0-draft.391 → 3.0.0-draft.392

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.
@@ -245,9 +245,17 @@ function handleObject(schema, rootSchema, ignoreBinary) {
245
245
  function handleArray(schema, rootSchema, ignoreBinary) {
246
246
  if (schema.items) {
247
247
  const itemSchema = schema.items;
248
+ // Check if the items are binary strings that should be ignored
249
+ if (ignoreBinary && itemSchema.type === 'string' && itemSchema.format === 'binary') {
250
+ return undefined;
251
+ }
248
252
  const minItems = schema.minItems || 1;
249
253
  const numItems = Math.min(minItems, 3);
250
254
  const items = Array.from({ length: numItems }, () => getSampleValue(itemSchema, rootSchema, ignoreBinary)).filter((item) => item !== undefined); // Filter out undefined values from ignored binary items
255
+ // If all items were filtered out (e.g., all were binary), return undefined instead of empty array
256
+ if (items.length === 0 && numItems > 0) {
257
+ return undefined;
258
+ }
251
259
  return items;
252
260
  }
253
261
  return [];
@@ -245,9 +245,17 @@ function handleObject(schema, rootSchema, ignoreBinary) {
245
245
  function handleArray(schema, rootSchema, ignoreBinary) {
246
246
  if (schema.items) {
247
247
  const itemSchema = schema.items;
248
+ // Check if the items are binary strings that should be ignored
249
+ if (ignoreBinary && itemSchema.type === 'string' && itemSchema.format === 'binary') {
250
+ return undefined;
251
+ }
248
252
  const minItems = schema.minItems || 1;
249
253
  const numItems = Math.min(minItems, 3);
250
254
  const items = Array.from({ length: numItems }, () => getSampleValue(itemSchema, rootSchema, ignoreBinary)).filter((item) => item !== undefined); // Filter out undefined values from ignored binary items
255
+ // If all items were filtered out (e.g., all were binary), return undefined instead of empty array
256
+ if (items.length === 0 && numItems > 0) {
257
+ return undefined;
258
+ }
251
259
  return items;
252
260
  }
253
261
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.391",
3
+ "version": "3.0.0-draft.392",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",