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

Required field not properly set #53

Open
furstenheim opened this issue Feb 3, 2020 · 0 comments
Open

Required field not properly set #53

furstenheim opened this issue Feb 3, 2020 · 0 comments

Comments

@furstenheim
Copy link

Required is wrongly set for arrays of items

> var generator = require('generate-schema')
> generator.json([{a: 1, b: 2}, {a: 2, b: 3}, {b: 5}])
{
  '$schema': 'http://json-schema.org/draft-04/schema#',
  type: 'array',
  items: {
    type: 'object',
    properties: { a: [Object], b: [Object] },
    required: [ 'a', 'b' ]
  }
}

a cannot be required since it is not in the last item.
It might be related to #32

Thanks

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