Skip to content

Commit

Permalink
feat: implement zod schema for versionInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
wldeh committed Mar 22, 2024
1 parent 25c3d65 commit a247255
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"cheerio": "^1.0.0-rc.12",
"path": "^0.12.7",
"unzip-stream": "^0.3.1",
"xmldom": "^0.6.0"
"xmldom": "^0.6.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
Expand Down
28 changes: 28 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
import { z } from 'zod';

const languageSchema = z.object({
name: z.string(),
code: z.string(),
level: z.string(),
});

const countrySchema = z.object({
name: z.string(),
code: z.string(),
});

export const versionInfoSchema = z.object({
id: z.string(),
version: z.string(),
description: z.string(),
scope: z.string(),
language: languageSchema,
country: countrySchema,
numeralSystem: z.string(),
script: z.string(),
archivist: z.string(),
copyright: z.string(),
localVersionName: z.string(),
localVersionAbbreviation: z.string(),
});

export interface Verse {
book: string | undefined
chapter: string | undefined
Expand Down

0 comments on commit a247255

Please sign in to comment.