Nestjs + Swagger: How to add a custom option to @ApiProperty

Diposting pada

Nestjs + Swagger: How to add a custom option to @ApiProperty
Is it possible to add a custom option to @ApiProperty decorator?
import { ApiProperty } from ‘@nestjs/swagger’;

class Animal {

@ApiProperty({
type: String,
description: ‘animal name’,
‘x-description’: ‘some information’ // how to add a cutom option ‘x-description’ ?
})
name: string;
}

Answer
I’m not sure i fully understand, but If you are talking about https://swagger.io/docs/specification/openapi-extensions/. Take a look at this: https://github.com/nestjs/swagger/issues/195

 37 total views,  1 views today

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *