You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var test = require('tape');
var avsc = require('avsc');
test('should be valid', function(assert) {
assert.plan(1);
var schema = avsc.parse({
type: "record",
name: "nullable",
fields: [
{ name: "foo", type: [ "null", "string" ] }
]
});
var valid = schema.isValid({ foo: "bar" }, { errorHook: assert.comment });
assert.ok(valid);
});
And I was expecting that {"foo":"bar"} is valid based on the schema defined above but it seems not, because test fails with valid === false as a result of isValid call.
I am using node v4.2.3 and avsc ^3.3.11 and in order to get the above running npm install tape
The text was updated successfully, but these errors were encountered:
I just realized that the value of "foo" should be { string: 'var' } is this instructed from the specification? is it allowed to have the { "foo": "bar" } syntax?
This is how the spec defines JSON-encoding. It is also used to represent decoded values in order to guarantee correctness. If you can make assumptions on your schemas (for example, you only ever have unions ["null", something]), you might be able to use the representation you mention and still remain correct. See #16 for more context and examples.
I have the following simple example:
And I was expecting that
{"foo":"bar"}
is valid based on the schema defined above but it seems not, because test fails withvalid === false
as a result of isValid call.I am using node
v4.2.3
and avsc^3.3.11
and in order to get the above runningnpm install tape
The text was updated successfully, but these errors were encountered: