Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using anyOf inside a schema results in an error #132

Open
git-commit opened this issue Jan 2, 2023 · 0 comments
Open

Using anyOf inside a schema results in an error #132

git-commit opened this issue Jan 2, 2023 · 0 comments

Comments

@git-commit
Copy link

Using the anyOf operator inside a JSONSchema doesn't seem to work in the library:

import { buildYup } from "schema-to-yup";
let schema = {
      "type": "object",
      "properties": {
        "a": {
          "anyOf": [
            {
              "type": "string",
            },
            {
              "type": "number"
            }
          ]
        },
      }
    }
console.log(buildYup(schema))

Results in the following error:

TypeError: Spread syntax requires ...iterable[Symbol.iterator] to be a function
    at at.error (<anonymous>:1408:61)
    at at.toEntry (<anonymous>:1413:18)
    at Object.ot [as createYupSchemaEntry] (<anonymous>:1421:27)
    at ct.createYupSchemaEntry (<anonymous>:1519:30)
    at ct.propToYupSchemaEntry (<anonymous>:1516:23)
    at ct.reducePropToShape (<anonymous>:1512:27)
    at <anonymous>:1509:40
    at ct.objPropsToShape (<anonymous>:1509:21)

Should anyOf be working at all or am I missing something obvious?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant