-
Notifications
You must be signed in to change notification settings - Fork 189
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
description is purged if class attribute has a default value #1531
Comments
There was a recent pull request that added support for default values. Looks like it has a bug. Can you take a look? |
For a property with a type annotation, this project uses ts-json-schema-generator/src/NodeParser/AnnotatedNodeParser.ts Lines 79 to 80 in ad97318
I think ts-json-schema-generator/src/NodeParser/InterfaceAndClassNodeParser.ts Lines 128 to 131 in ad97318
It seems like the result of I don't understand this project well enough to fix this properly. I'm not sure why |
@domoritz Can you please take a look? This issue is blocking use of the schema generator with classes. |
I don't have cycles but I could be happy to merge a pull request with a fix or a revert. |
For those facing this issue, using the form |
In my case, using /**
* Tax percentage
* @default 0
*/
tax: number; This generated: "tax": {
"type": "number",
"description": "Tax percentage",
"default": 0
}, |
ts-json-schema-generator appears to be bugged when generating schemas for classes.
For example:
This will correctly work to generate:
However, if we change it to have a default property like this:
The description value will be purged:
The text was updated successfully, but these errors were encountered: