genson-js
genson-js copied to clipboard
Only schema for top level keys generated
Is it correct that this only creates the schema from top level keys? E.g
{
extra: {
point: {
value: null,
name: 'Bob',
},
},
}
has schema:
{
type: 'object',
properties: {
extra: { type: 'object', properties: [Object], required: [Array] }
},
required: [ 'extra' ]
}
Is it possible to also generate populate the schema for nested fields point
, value
, name
?
@johnfrancisgit Are you doing a console log here? There is a limit to the depth that console.log will output. That [Object] and [Array] is a giveaway that there's more data you're not seeing.
The util.inspect method can be used in conjunction with console.log()
for this kind of thing.
Try this to see the full object (assuming a variable called schema
that contains your schema):
const { inspect } = require('util');
console.log(inspect(schema, false, 10, true));
10
is the depth you want to expand in the object you're inspecting, adjust as needed.