Skip to content

Commit

Permalink
Ensure consistent imports from zod (#2015)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail committed Sep 1, 2024
1 parent ec4c63b commit f950252
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ZodError } from "zod";
import { z } from "zod";
import { getMessageFromError } from "./common-helpers";
import { OpenAPIContext } from "./documentation-helpers";

Expand Down Expand Up @@ -38,7 +38,7 @@ export class IOSchemaError extends Error {
export class OutputValidationError extends IOSchemaError {
public override name = "OutputValidationError";

constructor(public readonly originalError: ZodError) {
constructor(public readonly originalError: z.ZodError) {
super(getMessageFromError(originalError));
}
}
Expand All @@ -47,7 +47,7 @@ export class OutputValidationError extends IOSchemaError {
export class InputValidationError extends IOSchemaError {
public override name = "InputValidationError";

constructor(public readonly originalError: ZodError) {
constructor(public readonly originalError: z.ZodError) {
super(getMessageFromError(originalError));
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/errors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ZodError } from "zod";
import { z } from "zod";
import { DocumentationError, RoutingError } from "../../src";
import {
IOSchemaError,
Expand Down Expand Up @@ -52,7 +52,7 @@ describe("Errors", () => {
});

describe("OutputValidationError", () => {
const zodError = new ZodError([]);
const zodError = new z.ZodError([]);

test("should be an instance of IOSchemaError and Error", () => {
expect(new OutputValidationError(zodError)).toBeInstanceOf(IOSchemaError);
Expand All @@ -73,7 +73,7 @@ describe("Errors", () => {
});

describe("InputValidationError", () => {
const zodError = new ZodError([]);
const zodError = new z.ZodError([]);

test("should be an instance of IOSchemaError and Error", () => {
expect(new InputValidationError(zodError)).toBeInstanceOf(IOSchemaError);
Expand Down

0 comments on commit f950252

Please sign in to comment.