kristianmandrup / schema-to-yup

Schema to Yup validation
Other
283 stars 50 forks source link

TypeError: Invalid attempt to spread non-iterable instance. #167

Open SvyatoslavPozhydaev opened 9 months ago

SvyatoslavPozhydaev commented 9 months ago

https://github.com/kristianmandrup/schema-to-yup/blob/67e33470f210e53d3fe755a3227429b8c3f4b04f/src/entry.js#L110

TypeError: Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    at _nonIterableSpread (nonIterableSpread.js:8:9)
    at _toConsumableArray (toConsumableArray.js:14:304)
    at YupSchemaEntry.error (entry.js:171:423)
    at YupSchemaEntry.toEntry (entry.js:179:14)
    at Object.createYupSchemaEntry (create-entry.js:10:71)
    at YupBuilder.createYupSchemaEntry (yup-builder.js:282:26)
    at YupBuilder.propToYupSchemaEntry (yup-builder.js:276:19)
    at YupBuilder.reducePropToShape (yup-builder.js:251:33)
    at eval (yup-builder.js:245:16)
    at Array.reduce (<anonymous>)

opts is object

object cant spread to array

rasmusrim commented 1 month ago

Same problem here. This was due to a $ref in my schema definition. This library does not support $ref