API reference / @chanx-js/nestjs / dtoSchema
Function: dtoSchema()
ts
function dtoSchema<T>(dto, validatorOptions?): StandardSchemaV1<unknown, T>;Defined in: packages/nestjs/src/dto.ts:35
A class-validator DTO as a Standard Schema, for defineMessage: payloads are turned into DTO instances and validated. AsyncAPI documents it from @ApiProperty when the DTO has it (@nestjs/swagger), else from its validation decorators (class-validator-jsonschema), else as an open object.
ts
const Chat = defineMessage('chat', dtoSchema(ChatPayload));Type Parameters
| Type Parameter |
|---|
T extends object |
Parameters
| Parameter | Type |
|---|---|
dto | Type<T> |
validatorOptions | ValidatorOptions |
Returns
StandardSchemaV1<unknown, T>