fastify-type-provider-zod
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -34,6 +34,2 @@ import type { FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, FastifySchema, FastifySchemaCompiler, FastifyTypeProvider, RawServerBase, RawServerDefault } from 'fastify'; | ||
export declare const validatorCompiler: FastifySchemaCompiler<ZodAny>; | ||
export declare class ResponseValidationError extends Error { | ||
details: FreeformRecord; | ||
constructor(validationResult: FreeformRecord); | ||
} | ||
export declare const serializerCompiler: FastifySerializerCompiler<ZodAny | { | ||
@@ -40,0 +36,0 @@ properties: ZodAny; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.serializerCompiler = exports.ResponseValidationError = exports.validatorCompiler = exports.jsonSchemaTransform = exports.createJsonSchemaTransform = void 0; | ||
exports.serializerCompiler = exports.validatorCompiler = exports.jsonSchemaTransform = exports.createJsonSchemaTransform = void 0; | ||
const zod_to_json_schema_1 = require("zod-to-json-schema"); | ||
const ResponseValidationError_1 = require("./ResponseValidationError"); | ||
const defaultSkipList = [ | ||
@@ -88,11 +89,3 @@ '/documentation/', | ||
} | ||
class ResponseValidationError extends Error { | ||
constructor(validationResult) { | ||
super("Response doesn't match the schema"); | ||
this.name = 'ResponseValidationError'; | ||
this.details = validationResult.error; | ||
} | ||
} | ||
exports.ResponseValidationError = ResponseValidationError; | ||
const serializerCompiler = ({ schema: maybeSchema }) => (data) => { | ||
const serializerCompiler = ({ schema: maybeSchema, method, url }) => (data) => { | ||
const schema = resolveSchema(maybeSchema); | ||
@@ -103,4 +96,4 @@ const result = schema.safeParse(data); | ||
} | ||
throw new ResponseValidationError(result); | ||
throw new ResponseValidationError_1.ResponseValidationError(result, method, url); | ||
}; | ||
exports.serializerCompiler = serializerCompiler; |
{ | ||
"name": "fastify-type-provider-zod", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Zod Type Provider for Fastify@4", | ||
@@ -14,4 +14,4 @@ "main": "dist/index.js", | ||
"build": "tsc", | ||
"test": "npm run build && npm run typescript && jest", | ||
"test:coverage": "jest --coverage", | ||
"test": "npm run build && npm run typescript && vitest", | ||
"test:coverage": "vitest --coverage", | ||
"lint": "eslint .", | ||
@@ -47,6 +47,6 @@ "lint:fix": "eslint --fix . && prettier --write .", | ||
"@fastify/swagger-ui": "^3.0.0", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.12.12", | ||
"@typescript-eslint/eslint-plugin": "^7.9.0", | ||
"@typescript-eslint/parser": "^7.9.0", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"eslint": "^8.57.0", | ||
@@ -56,8 +56,7 @@ "eslint-plugin-import": "^2.29.1", | ||
"fastify-plugin": "^4.5.1", | ||
"jest": "^29.7.0", | ||
"oas-validator": "^5.0.8", | ||
"prettier": "^3.2.5", | ||
"ts-jest": "^29.1.2", | ||
"tsd": "^0.31.0", | ||
"typescript": "^5.4.5", | ||
"vitest": "^1.6.0", | ||
"zod": "^3.23.8" | ||
@@ -64,0 +63,0 @@ }, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12422
16
7
184
0