Skip to content

Commit 72ae1c2

Browse files
committed
feat(cmd/gt): serialise output to make sure that it matches the schema
1 parent a6505bd commit 72ae1c2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/cmds/generate-telephony/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import type { Command } from 'commander'
22

3-
import { OrganizationSchema, type TelephonyDirectory, type TelephonyDirectoryExchange, type TelephonyDirectoryOrg } from '@hackfed/schemas/v1'
3+
import {
4+
OrganizationSchema,
5+
type TelephonyDirectory,
6+
type TelephonyDirectoryExchange,
7+
type TelephonyDirectoryOrg,
8+
TelephonyDirectorySchema,
9+
} from '@hackfed/schemas/v1'
410
import { Glob, YAML } from 'bun'
511
import path from 'node:path'
612
import { type Logger } from 'tslog'
@@ -74,9 +80,9 @@ async function generateTelephonyDirectory (
7480
logger.debug('Added organization: %s (%s)', org.spec.name, org.spec.id)
7581
}
7682

77-
const directory: TelephonyDirectory = {
83+
const directory = TelephonyDirectorySchema.parse({
7884
orgs,
79-
}
85+
} satisfies TelephonyDirectory)
8086

8187
const file = Bun.file(path.resolve(options.output))
8288
await Bun.write(file, JSON.stringify(directory))

0 commit comments

Comments
 (0)