diff --git a/src/generators/typescript/presets/DescriptionPreset.ts b/src/generators/typescript/presets/DescriptionPreset.ts index a11612c030..8c9cd86a69 100644 --- a/src/generators/typescript/presets/DescriptionPreset.ts +++ b/src/generators/typescript/presets/DescriptionPreset.ts @@ -37,7 +37,7 @@ export const TS_DESCRIPTION_PRESET: TypeScriptPreset = { self({ renderer, model, content }) { return renderDescription({ renderer, content, item: model }); }, - property({ renderer, property, content }) { + getter({ renderer, property, content }) { return renderDescription({ renderer, content, item: property.property }); } }, diff --git a/test/generators/typescript/preset/__snapshots__/DescriptionPreset.spec.ts.snap b/test/generators/typescript/preset/__snapshots__/DescriptionPreset.spec.ts.snap index 59f18c2017..6d1ad289d4 100644 --- a/test/generators/typescript/preset/__snapshots__/DescriptionPreset.spec.ts.snap +++ b/test/generators/typescript/preset/__snapshots__/DescriptionPreset.spec.ts.snap @@ -6,14 +6,7 @@ exports[`Description generation should render example function for model 1`] = ` */ class Test { private _stringProp: string; - /** - * Description - * @example Example - */ private _numberProp?: number; - /** - * @example Example 1, Example 2 - */ private _objectProp?: NestedTest; private _additionalProperties?: Map; @@ -32,9 +25,16 @@ class Test { get stringProp(): string { return this._stringProp; } set stringProp(stringProp: string) { this._stringProp = stringProp; } + /** + * Description + * @example Example + */ get numberProp(): number | undefined { return this._numberProp; } set numberProp(numberProp: number | undefined) { this._numberProp = numberProp; } + /** + * @example Example 1, Example 2 + */ get objectProp(): NestedTest | undefined { return this._objectProp; } set objectProp(objectProp: NestedTest | undefined) { this._objectProp = objectProp; }