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

Multiple types does not work #700

Closed
henit opened this issue Sep 18, 2017 · 3 comments
Closed

Multiple types does not work #700

henit opened this issue Sep 18, 2017 · 3 comments

Comments

@henit
Copy link

henit commented Sep 18, 2017

Description

Array in types does not work

From doc: The value of this keyword MUST be either a string or an array. If it is an array, elements of the array MUST be strings and MUST be unique.

Steps to Reproduce

Schema:

example: {
    type: ['string', 'number']
},

Actual behavior

Unsupported field schema for field root_externalId: Unknown field type string,number.
{
    "type": [
        "string",
        "number"
    ]
}

Version

react-jsonschema-form 0.50.1

@browne0
Copy link

browne0 commented Sep 20, 2017

I think you're looking for oneOf instead of type. it would look like

{
  "oneOf": [
    {
       "type": "string"
    },
    {
       "type": "number"
    },
  ]
}

@henit
Copy link
Author

henit commented Sep 21, 2017

Isn't oneOf, allOf and anyOf still unsupported in react-jsonschema-form? In any case, the Json Schema specifications says type can be an array of strings and not just one type. I was just wondering if the error message I experienced was a bug or if the type array feature is not supported yet.

@glasserc
Copy link
Contributor

That's correct, neither oneOf, anyOf, or multiple types are supported yet, for largely the same reason. The documentation you quoted is from the JSON Schema spec, not the react-jsonschema-form documentation. Duplicate of #282.

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

3 participants