Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
docs(api): publish the channel description length cap
Yudhi Armyndharis7839542ddec9
diff --git a/src/modules/channel/dto/create-channel.dto.spec.ts b/src/modules/channel/dto/create-channel.dto.spec.tsnew file mode 100644index 000000000..24f5c361a--- /dev/null+++ b/src/modules/channel/dto/create-channel.dto.spec.ts@@ -0,0 +1,15 @@+import { CreateChannelDto } from './create-channel.dto';++const property = (name: string) =>+ Reflect.getMetadata('swagger/apiModelProperties', CreateChannelDto.prototype, name) as { maxLength?: number };++// The validator caps both fields; the contract has to publish the same caps, or a generated client+// accepts input the server then refuses.+describe('CreateChannelDto contract', () => {+ it.each([+ ['name', 100],+ ['description', 2048],+ ])('publishes the %s length cap the validator enforces', (name, max) => {+ expect(property(name).maxLength).toBe(max);+ });+});diff --git a/src/modules/channel/dto/create-channel.dto.ts b/src/modules/channel/dto/create-channel.dto.tsindex 3971106d0..26adfea5b 100644--- a/src/modules/channel/dto/create-channel.dto.ts+++ b/src/modules/channel/dto/create-channel.dto.ts@@ -10,7 +10,11 @@ export class CreateChannelDto {@MaxLength(100)name!: string;- @ApiPropertyOptional({ description: 'Channel description', example: 'Release notes and downtime notices' })+ @ApiPropertyOptional({+ description: 'Channel description',+ example: 'Release notes and downtime notices',+ maxLength: 2048,+ })@IsOptional()@IsString()@MaxLength(2048)