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

JSON Schema type: ['integer','null'] not supported #292

Closed
nikmartin opened this issue Aug 14, 2015 · 3 comments · May be fixed by #747
Closed

JSON Schema type: ['integer','null'] not supported #292

nikmartin opened this issue Aug 14, 2015 · 3 comments · May be fixed by #747

Comments

@nikmartin
Copy link

I have a JSON schema for a field:

  'age': { // age
      title: 'Your age',
      type: ['integer','null'],
      minimum: 1,
      maximum: 120
    }

And alpaca throws the error:
Uncaught Error: Alpaca caught an error with the default error handler: {"message":"Unable to find field class for type: undefined","reason":"FIELD_INSTANTIATION_ERROR"}

Is it possible to support multiple types for a field in Alpaca? I need to be able to support null in an integer field that is required. It's a required field, but null or an integer are valid values.

@uzquiano
Copy link
Member

This isn't supported right now. Would an alternative approach be to support a flag that says "allow null"?

@nikmartin
Copy link
Author

Possibly, but I'd have to see what the implementation would look like in regards to my schema validation on the schema side

@uzquiano
Copy link
Member

Okay. There isn't any plan to support multiple data types per field instance. The alternative mentioned above is a possibility. If you think that's the way to go, please open another ticket with that request. Closing this.

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

Successfully merging a pull request may close this issue.

2 participants