diff --git a/lib/util/schema-utils.spec.ts b/lib/util/schema-utils.spec.ts index 5d89bbeb2aa561022a6cbfe277c7e17644b2a280..2f3c5581206d78d5972da57c9572c9245e60ad03 100644 --- a/lib/util/schema-utils.spec.ts +++ b/lib/util/schema-utils.spec.ts @@ -6,7 +6,6 @@ import { LooseArray, LooseRecord, Toml, - Url, UtcDate, Yaml, } from './schema-utils'; @@ -281,24 +280,6 @@ describe('util/schema-utils', () => { }); }); - describe('Url', () => { - it('parses valid URLs', () => { - const urlStr = 'https://www.example.com/foo/bar?baz=qux'; - const parsedUrl = Url.parse(urlStr); - expect(parsedUrl).toMatchObject({ - protocol: 'https:', - hostname: 'www.example.com', - pathname: '/foo/bar', - search: '?baz=qux', - }); - }); - - it('throws an error for invalid URLs', () => { - const urlStr = 'invalid-url-string'; - expect(() => Url.parse(urlStr)).toThrow('Invalid URL'); - }); - }); - describe('Yaml', () => { const Schema = Yaml.pipe( z.object({ foo: z.array(z.object({ bar: z.literal('baz') })) }) diff --git a/lib/util/schema-utils.ts b/lib/util/schema-utils.ts index 086722cddfb743a00a5210efe2e34a4a19920d4e..96690106e958e4629ff6d2ec47b70525e10e3add 100644 --- a/lib/util/schema-utils.ts +++ b/lib/util/schema-utils.ts @@ -226,15 +226,6 @@ export const UtcDate = z return date; }); -export const Url = z.string().transform((str, ctx): URL => { - try { - return new URL(str); - } catch (e) { - ctx.addIssue({ code: 'custom', message: 'Invalid URL' }); - return z.NEVER; - } -}); - export const Yaml = z.string().transform((str, ctx): JsonValue => { try { return load(str, { json: true }) as JsonValue;