fix: Allow saved credenitals types of up to 64 characters instead of 32 (#13985)

This commit is contained in:
Jon
2025-03-18 15:47:30 +00:00
committed by GitHub
parent fa7e7ac2e7
commit bc15bb18d9
2 changed files with 13 additions and 2 deletions

View File

@@ -34,6 +34,17 @@ describe('CreateCredentialDto', () => {
}, },
}, },
}, },
{
name: 'longer type',
request: {
name: 'LinkedIn Community Management OAuth2 API',
type: 'linkedInCommunityManagementOAuth2Api',
data: {
clientId: '123',
clientSecret: 'secret',
},
},
},
])('should validate $name', ({ request }) => { ])('should validate $name', ({ request }) => {
const result = CreateCredentialDto.safeParse(request); const result = CreateCredentialDto.safeParse(request);
expect(result.success).toBe(true); expect(result.success).toBe(true);
@@ -110,7 +121,7 @@ describe('CreateCredentialDto', () => {
name: 'type too long', name: 'type too long',
request: { request: {
name: 'My API Credentials', name: 'My API Credentials',
type: 'a'.repeat(33), type: 'a'.repeat(129),
data: {}, data: {},
}, },
expectedErrorPath: ['type'], expectedErrorPath: ['type'],

View File

@@ -3,7 +3,7 @@ import { Z } from 'zod-class';
export class CreateCredentialDto extends Z.class({ export class CreateCredentialDto extends Z.class({
name: z.string().min(1).max(128), name: z.string().min(1).max(128),
type: z.string().min(1).max(32), type: z.string().min(1).max(128),
data: z.record(z.string(), z.unknown()), data: z.record(z.string(), z.unknown()),
projectId: z.string().optional(), projectId: z.string().optional(),
}) {} }) {}