feat: Stricter JSON validation (#534)

* Max length on title and description

* Fix repo link

* Update @casual-ui/svelte reference

* Update @perfectthings/ui reference

* Merge form-related tags

* More tags tweaks

* Remove "component sets" tag

* Maximum of 5 tags
This commit is contained in:
Lachlan Collins
2023-12-21 09:55:38 +11:00
committed by GitHub
parent f0442d55e8
commit f63fef858e
3 changed files with 141 additions and 197 deletions

View File

@@ -3,11 +3,11 @@ import { packageNameRegex } from 'package-name-regex';
export const packagesSchema = z.array(
z.object({
title: z.string(),
title: z.string().max(50),
npm: z.string().regex(packageNameRegex),
url: z.string().url().optional(),
repository: z.string().url(),
description: z.string(),
description: z.string().max(250),
category: z.enum([
'Bundler Plugins',
'CSS and Layout',
@@ -30,17 +30,17 @@ export const packagesSchema = z.array(
'Testing',
'User Interaction'
]),
tags: z.array(z.string()).optional()
tags: z.array(z.string()).max(5).optional()
})
);
export const templatesSchema = z.array(
z.object({
title: z.string(),
title: z.string().max(50),
url: z.string().url().optional(),
repository: z.string().url(),
description: z.string(),
description: z.string().max(250),
category: z.enum(['Svelte Add', 'SvelteKit', 'Svelte']),
tags: z.array(z.string()).optional()
tags: z.array(z.string()).max(5).optional()
})
);