Skip to content

Commit

Permalink
feat(ui): Add validation schema for issue severity
Browse files Browse the repository at this point in the history
The schema is used for search parameter validation on issues page.

Signed-off-by: Jyrki Keisala <[email protected]>
  • Loading branch information
Etsija committed Oct 29, 2024
1 parent 5dc30e5 commit f077779
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ui/src/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import z from 'zod';

import { OrtRunStatus } from '@/api/requests';
import { OrtRunStatus, Severity } from '@/api/requests';

// Pagination schema that is used for search parameter validation
export const paginationSchema = z.object({
Expand All @@ -43,3 +43,15 @@ export const ortRunStatus: z.ZodEnum<[OrtRunStatus, ...OrtRunStatus[]]> =
export const statusSchema = z.object({
status: z.array(ortRunStatus).optional(),
});

// Enum schema for the possible values of the issue severities
export const issueSeverity: z.ZodEnum<[Severity, ...Severity[]]> = z.enum([
'HINT',
'WARNING',
'ERROR',
]);

// Issue severity schema that is used for search parameter validation
export const issueSeveritySchema = z.object({
severity: z.array(issueSeverity).optional(),
});

0 comments on commit f077779

Please sign in to comment.