json-schema-to-typescript
json-schema-to-typescript copied to clipboard
Array `items` object with `tsEnumNames` needs a `title`
If you remove the title inside properties.namedEnum.items from the test/e2e/arrayOfEnum.ts, an error will be thrown:
TypeError {
message: 'Cannot read property \'endsWith\' of undefined',
}
> src/generator.ts:182:21
This looks like a bug to me, as the items object in json schema is not required to have a title.
If this is indeed a design decision/limitation, it would be nice to properly document it. The error is very opaque, it took me some time to see what's the problem with my code.
Thanks already for taking a look, and of course for providing this really helpful package 🎉
+1 Didn't even know you could add a title to the items object! Thanks for raising this @stefanpl as I now know adding the title on-the-fly provides a temporary solution.
Just ran into this, thanks for posting the workaround