n3ps / json-schema-to-jsdoc

Generate JSDoc from JSON Schema
https://francisn.com/json-schema-to-jsdoc/
ISC License
30 stars 11 forks source link

Use `minItems` or lack to determine optionality for array items #46

Closed brettz9 closed 4 years ago

brettz9 commented 4 years ago

The prior behavior was that array items would all be marked as required (note that the JSON Schema required property expects property names, as with object names, not array indexes, so it can't be used with array items).

But the behavior with this PR is to use minItems (whose default is 0), such that an item will only be required if it has an index less than minItems (so to get required array items, you now need minItems).

n3ps commented 4 years ago

Looks good, thanks again! I'll push a minor update.