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

Union types - schema not supported ? #39

Open
marafal opened this issue Apr 27, 2012 · 0 comments
Open

Union types - schema not supported ? #39

marafal opened this issue Apr 27, 2012 · 0 comments

Comments

@marafal
Copy link

marafal commented Apr 27, 2012

Hello,
In the https://github.com/Baggz/Amanda/blob/master/docs/json/comparison.md file, one can see in the union types, the element of the array can be a schema.

But it seems that is not currently supported :

C:\Documents and Settings\raphael>node -v
v0.6.15

C:\Documents and Settings\raphael>npm -v
1.1.16

C:\Documents and Settings\raphael>npm install amanda
npm http GET https://registry.npmjs.org/amanda
npm http 304 https://registry.npmjs.org/amanda
amanda@0.4.2 ./node_modules/amanda

C:\Documents and Settings\raphael>node

var schema = {type:'array', items: {type:['string', {type:'object'} ]}};
undefined
var strings = ["a","b","c","d"];
undefined
var objects = [{a:'a'},{b:'b'}];
undefined
var cb=function(error){console.log(error);}
undefined
validator.validate(strings, schema, cb);
undefined
undefined
validator.validate(objects, schema, cb);
Error: Type 'string,[object Object]' is not supported.
at C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:1050:23
at Array.some (native)
at Object.type (C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:1047:42)
at C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:1736:32
at C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:86:24
at C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:78:30
at C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:1744:20
at C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:86:24
at C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:78:30
at C:\Documents and Settings\raphael\node_modules\amanda\releases\latest\amanda.js:1744:20

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