Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Union types - schema not supported ? #39

Open
raphaelpieroni opened this Issue · 0 comments

1 participant

@raphaelpieroni

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
Something went wrong with that request. Please try again.