Skip to content

Commit

Permalink
Removing the deprecated withMeta() (#1726)
Browse files Browse the repository at this point in the history
Due to #1719
  • Loading branch information
RobinTail committed May 4, 2024
1 parent 4f7f31e commit f66de3f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- Minimum supported versions:
- Node: 18.18.0 or 20.9.0,
- `zod`: 3.23.0.
- The deprecated ~~`withMeta()`~~ is removed:
- See the changes to [v18.5.0](#v1850) on details.

## Version 18

Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export {
InputValidationError,
MissingPeerError,
} from "./errors";
export { withMeta } from "./metadata";
export { testEndpoint } from "./testing";
export { Integration } from "./integration";

Expand Down
6 changes: 0 additions & 6 deletions src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,3 @@ export const proprietary = <T extends z.ZodTypeAny>(

export const isProprietary = (schema: z.ZodTypeAny, kind: ProprietaryKind) =>
getMeta(schema, "kind") === kind;

/**
* @deprecated no longer required
* @todo remove in v19
* */
export const withMeta = <T extends z.ZodTypeAny>(schema: T) => schema;
3 changes: 0 additions & 3 deletions tests/unit/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,10 @@ exports[`Index Entrypoint > exports > should have certain entities exposed 1`] =
"OutputValidationError",
"InputValidationError",
"MissingPeerError",
"withMeta",
"testEndpoint",
"Integration",
"ez",
]
`;

exports[`Index Entrypoint > exports > testEndpoint should have certain value 1`] = `[Function]`;

exports[`Index Entrypoint > exports > withMeta should have certain value 1`] = `[Function]`;
11 changes: 0 additions & 11 deletions tests/unit/metadata.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import { expectType } from "tsd";
import { z } from "zod";
import { withMeta } from "../../src";
import { copyMeta, getMeta, hasMeta, metaSymbol } from "../../src/metadata";
import { describe, expect, test } from "vitest";

describe("Metadata", () => {
describe("withMeta()", () => {
test("should be present for backward compatibility", () => {
const schema = z.string();
const schemaWithMeta = withMeta(schema);
expect(schemaWithMeta).toEqual(schema);
expectType<z.ZodString>(schemaWithMeta);
});
});

describe(".example()", () => {
test("should be present", () => {
const schema = z.string();
Expand Down

0 comments on commit f66de3f

Please sign in to comment.