bcherny/json-schema-to-typescript
View on GitHubdescription conversion to comments may break if not escaped
Open
#166 opened on Jun 6, 2018
buggood first issuehelp wanted
Repository metrics
- Stars
- (3,302 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
{
"type": "object",
"description": "thing",
"properties": {
"oops": {
"type": "object",
"description": "oops I did it again */"
}
},
"minProperties": 1,
"additionalProperties": false
}
Because the description is directly converted to a javascript comment inside a /** */ the */ in the JSON description causes an early termination of the comment and breaks the conversion, causing an error like:
± ./node_modules/.bin/json2ts /tmp/test.json Property or signature expected. (13:2)
11 | /**
12 | * oops I did it again */
> 13 | */
| ^
14 | oops?: {
15 | [k: string]: any
16 | }%
version
± ./node_modules/.bin/json2ts --help
json-schema-to-typescript 5.5.0
...