강의

멘토링

로드맵

Inflearn Community Q&A

support8934's profile image
support8934

asked

Slack Clone Coding [Backend with NestJS + TypeORM]

Creating API documentation (Swagger)

옵셔널한 프로퍼티에서 ?의 사용

Written on

·

328

0

안녕하세요.

강의를 보고 프로젝트 진행중 질문사항이 있어서 문의드립니다.
response와 request dto 분리해서 작업중인데

response dto에서 

@ApiProperty({nullable:true})
@Expose()
name?: string;
이렇게 작성시 '?'를 작성할 필요가 없지않나 싶어서요!
?가 값이 optional로 들어오지 않을 수 있다라는 느낌인데
이건 request dto에서만 작성하고 response dto에서는 작성안해도되는게 맞을까요?
nodejsexpressTypeORMNestJS

Quiz

51% of people got it wrong. Give it a try!

NestJS에서 컨트롤러를 생성할 때 일반적으로 먼저 생성하는 것이 권장되는 주요 구성 요소는 무엇일까요?

Service

Pipe

Module

Guard

Answer 1

0

zerocho님의 프로필 이미지
zerocho
Instructor

response dto에서도 name이 필수로 존재하는 게 아니라면 ?가 있어도 됩니다.

support8934's profile image
support8934

asked

Ask a question