ts-json-schema-generator icon indicating copy to clipboard operation
ts-json-schema-generator copied to clipboard

jsdoc @example & @examples are both output into "examples" field

Open JoshuaCarter opened this issue 2 years ago • 1 comments

In short, I want pic below:

Screenshot from 2023-03-28 16-42-16

But can only have pic below:

Screenshot from 2023-03-28 16-43-04

https://github.com/vega/ts-json-schema-generator/blob/fad197f4f32d070a9fb0e8228cbb98ee70d9f83c/src/AnnotationsReader/ExtendedAnnotationsReader.ts#L91-L94

Code above reads in the @example jsdoc field and outputs it as examples: .... The @examples field seems to be automatically/generically output as the examples: ... field.

From what I can see, the getExampleAnnotation method should not read in the @example jsdoc field, and should read in the @examples jsdoc field. Or perhaps both should be explicitly handled?

JoshuaCarter avatar Mar 28 '23 05:03 JoshuaCarter

@JoshuaCarter are you going to submit a PR ?

It seems to me it should return { example: examples[0] } at the end if there is only one example.

cedvdb avatar Jun 21 '23 16:06 cedvdb