Closed
Description
In an ill advised effort to use the new multitype tuple feature to allow any type in an object in any position of an Array, I think I've uncovered a weird bug:
here is my schema for an Array property "args":
args: {
items: [
{
type: 'object',
patternProperties: {
'.*': {
type: 'string',
},
},
},
{
type: 'object',
patternProperties: {
'.*': {
type: 'number',
},
},
},
{
type: 'object',
patternProperties: {
'.*': {
type: 'null',
},
},
},
{
type: 'object',
patternProperties: {
'.*': {
type: 'boolean',
},
},
},
],
type: 'array',
},
and then here is my object:
const obj = {
args: [
'foo',
{
foo: 1,
bar: 'foo',
}
],
};
This is the result:
{"args":[,{"foo":"1","bar":"foo"}{"foo":1,"bar":null}{"foo":null,"bar":null}{"foo":true,"bar":true}]}
I was just attempting to use this for which it wasn't intended, but at the same time, this returns an invalid JSON string, which I don't think is desirable behavior.
Metadata
Metadata
Assignees
Labels
No labels