Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 4 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@patternfly/patternfly-component-schemas": "1.2.0",
"fastest-levenshtein": "1.0.16",
"pid-port": "2.0.0",
"zod": "3.25.76"
"zod": "4.2.1"
},
"devDependencies": {
"@cdcabrera/eslint-config-toolkit": "^0.3.0",
Expand Down
125 changes: 125 additions & 0 deletions src/__tests__/__snapshots__/server.schema.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`jsonSchemaToZod should convert JSON Schema to Zod, array input, failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, array input, failFast true 1`] = `undefined`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, complex schema, failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": {},
"properties": {
"age": {
"type": "number",
},
"name": {
"type": "string",
},
},
"type": "object",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, complex schema, failFast true 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": {},
"properties": {
"age": {
"type": "number",
},
"name": {
"type": "string",
},
},
"type": "object",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, complex unsupported schema attempt, failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": {
"type": "string",
},
"type": "array",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, complex unsupported schema attempt, failFast true 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": {
"type": "string",
},
"type": "array",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, null input with failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, null input with failFast true 1`] = `undefined`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, number input, failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, number input, failFast true 1`] = `undefined`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, object schema with additionalProperties true, failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": {},
"properties": {},
"type": "object",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, object schema with additionalProperties true, failFast true 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": {},
"properties": {},
"type": "object",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, simple string schema, failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, simple string schema, failFast true 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, string input, failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, string input, failFast true 1`] = `undefined`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, undefined input with failFast false 1`] = `
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
}
`;

exports[`jsonSchemaToZod should convert JSON Schema to Zod, undefined input with failFast true 1`] = `undefined`;
Loading
Loading