{
"studentRollNo": 1,
"firstName": "name",
"class": "second standard",
"subjects": [
{
"sNo": "1.1",
"name": "social",
"marks": "89",
"questionsAttempted": "100%"
},
{
"sNo": "1.2",
"name": "mathematics",
"marks": "69",
"questionsAttempted": "100%"
}
]
}
1条答案
按热度按时间juzqafwq1#
下面是使用mongoose类转换器和swagger的示例方案
和DTO
您还可以使用class-validator向这些dto添加验证对于验证“subject”,请在SubjectDto中使用所需的验证,然后将
@ValidationNested({each: true})
添加到ExampleDto中的subjest字段如果对您有帮助,请将此答案标记为正确