Skip to content

Conversation

JoseGalRe
Copy link

Description

Add option to include the jsdoc of the rule options

Linked Issues

#17

@antfu
Copy link
Owner

antfu commented Aug 11, 2025

Can you add a test where this option is on? Thanks

@JoseGalRe
Copy link
Author

Can you add a test where this option is on? Thanks

sure, I'll add it in a few moments

@JoseGalRe
Copy link
Author

Can you add a test where this option is on? Thanks

done!

*/
type _PluginRuleWithDescriptionInPropertiesSchemaBId = string
interface _PluginRuleWithDescriptionInPropertiesSchemaSchemaId {
a?: _PluginRuleWithDescriptionInPropertiesSchemaAId
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the jsdocs should be here to make it effective on the userland, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I think that too, but the snapshot in the tests places it there, and all tests will pass, it's strange but works xD

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, snapshot only tests changes, but not correctness. If snapshot shows that, it means the implementation should be updated

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good point, I'll try out how to fix this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently, the json-schema-to-typescript-lite package

in the generateInterface and generateStandaloneType functions

the jsdocs is conditioned by ast.standaloneName if has standaloneName the jsdoc is placed in the top level type definition.

It can be fixed by adding an option to prefer the jsdoc of the options inside the interface instead of the top level type, (I can send a pr for this), or it can be left as is, and used in this way, because the original package also has this behavior (bcherny/json-schema-to-typescript), generateInterface and generateStandaloneType functions

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

Successfully merging this pull request may close these issues.

2 participants