diff --git a/src/core.spec.ts b/src/core.spec.ts index d0a79fd..86836d6 100644 --- a/src/core.spec.ts +++ b/src/core.spec.ts @@ -48,6 +48,32 @@ describe('core options', () => { }); }); + describe('description and depreacted properties', () => { + class Test { + @DtoDecorator({ + description: 'Deprecated. Just a normal boolean field', + deprecated: true, + }) + booleanField!: boolean; + } + + it('generates correct schema', async () => { + expect(await generateSchemas([Test])).toStrictEqual({ + Test: { + type: 'object', + properties: { + booleanField: { + type: 'boolean', + description: 'Deprecated. Just a normal boolean field', + deprecated: true, + }, + }, + required: ['booleanField'], + }, + }); + }); + }); + describe('optional', () => { class Test { @DtoDecorator({ optional: true, meta: 'hello' }) diff --git a/src/core.ts b/src/core.ts index c8a255e..94786a1 100644 --- a/src/core.ts +++ b/src/core.ts @@ -10,6 +10,7 @@ export type BasePropertyOptions = { name?: string; optional?: true; description?: string; + deprecated?: true; nullable?: true; }; @@ -35,6 +36,7 @@ export const compose = ( example, optional, description, + deprecated, default: def, name, }: PropertyOptions, @@ -62,6 +64,7 @@ export const compose = ( isArray: !!isArray, name, description, + deprecated, example, default: def, required: !optional,