When it comes to my POST endpoint, the documentation is generated for the create DTO. However, it doesn't work for the update DTO which is a mapped partial type from the create DTO.
Only the additional property is documented (check the screenshots). What seems to be the problem here? For further context, all libraries installed are on the latest version and I'm using SWC compiler.
controller.ts
`// ...some code on imports and implementation of class name
@Post()
async createOneOrMany(@Body() createDto: CreateEntityDto) {
console.log(createDto);
return createDto;
}
@Patch()
async update(@Body() updateDto: UpdateEntityDto) {
console.log(updateDto);
return updateDto;
}`
update-entity.dto.ts
`import { PartialType } from '@nestjs/swagger';
import { CreatePhysicianDto as CreateEntityDto } from './physician.dto';
export class UpdateEntityDto extends PartialType(CreateEntityDto) {
someAdditionalProperty: string;
}`
also, is this line of code necessary in main.ts even if I'm not on a monorepo? (reference: https://docs.nestjs.com/openapi/cli-plugin#swc-builder)
import metadata from './metadata'; // ... some code await SwaggerModule.loadPluginMetadata(metadata); // ...some code await app.listen(configService.get('PORT') || 3000);
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).