New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-zod-api

Package Overview
Dependencies
Maintainers
0
Versions
428
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-zod-api - npm Package Versions

1
43

21.3.0

Diff

Changelog

Source

v21.3.0

  • Fixed provide() method usage example in the code of the generated client;
  • Always splitting the response in the generated client:
    • This will print the positive and negative response types separately;
    • The splitResponse property on the Integration class constructor argument is deprecated.
robintail
published 21.3.0-beta.0 •

robintail
published 21.2.0 •

Changelog

Source

v21.2.0

  • Minor performance adjustments;
  • Introducing stricter overload for the generated ExpressZodAPIClient::provide() method:
    • The method can now also accept two arguments: space-separated method with path and parameters;
    • Using this overload provides strict constraints on the first argument so that undeclared routes can not be used;
    • This design is inspired by the OctoKit and aims to prevent the misuse by throwing a Typescript error.
  • Using ExpressZodAPIClient::provide() with three arguments is deprecated:
    • The return type when using undeclared routes corrected to unknown.
  • The Provider type of the generated client is deprecated;
  • The type of the following generated client entities is corrected so that it became limited to the listed routes:
    • Input, Response, PositiveResponse, NegativeResponse, MethodPath.
- client.provide("get", "/v1/user/retrieve", { id: "10" }); // deprecated
+ client.provide("get /v1/user/retrieve", { id: "10" }); // featured
robintail
published 21.2.0-beta.1 •

robintail
published 21.1.0 •

Changelog

Source

v21.1.0

  • Featuring empty response support:
    • For some REST APIs, empty responses are typical: with status code 204 (No Content) and redirects (302);
    • Previously, the framework did not offer a straightforward way to describe such responses, but now there is one;
    • The mimeType property can now be assigned with null in ResultHandler definition;
    • Both Documentation and Integration generators ignore such entries so that the schema can be z.never():
      • The body of such response will not be depicted by Documentation;
      • The type of such response will be described as undefined (configurable) by Integration.
import { z } from "zod";
import {
  ResultHandler,
  ensureHttpError,
  EndpointsFactory,
  Integration,
} from "express-zod-api";

const resultHandler = new ResultHandler({
  positive: { statusCode: 204, mimeType: null, schema: z.never() },
  negative: { statusCode: 404, mimeType: null, schema: z.never() },
  handler: ({ error, response }) => {
    response.status(error ? ensureHttpError(error).statusCode : 204).end(); // no content
  },
});

new Integration({ noContent: z.undefined() }); // undefined is default
robintail
published 21.1.0-beta.1 •

robintail
published 21.0.0 •

Changelog

Source

v21.0.0

  • Minimum supported versions of express: 4.21.1 and 5.0.1 (fixed vulnerabilities);
  • Breaking changes to createConfig() argument:
    • The server property renamed to http and made optional — (can now configure HTTPS only);
    • These properties moved to the top level: jsonParser, upload, compression, rawParser and beforeRouting;
    • Both logger and getChildLogger arguments of beforeRouting function are replaced with all-purpose getLogger.
  • Breaking changes to createServer() resolved return:
    • Both httpServer and httpsServer are combined into single servers property (array, same order).
  • Breaking changes to EndpointsFactory::build() argument:
    • Plural methods, tags and scopes properties replaced with singular method, tag, scope accordingly;
    • The method property also made optional and can now be derived from DependsOnMethod or imply GET by default;
    • When method is assigned with an array, it must be non-empty.
  • Breaking changes to positive and negative properties of ResultHandler constructor argument:
    • Plural statusCodes and mimeTypes props within the values are replaced with singular statusCode and mimeType.
  • Other breaking changes:
    • The serializer property of Documentation and Integration constructor argument removed;
    • The originalError property of InputValidationError and OutputValidationError removed (use cause instead);
    • The getStatusCodeFromError() method removed (use the ensureHttpError().statusCode instead);
    • The testEndpoint() method can no longer test CORS headers — that function moved to Routing traverse;
    • For Endpoint: getMethods() may return undefined, getMimeTypes() removed, getSchema() variants reduced;
    • Public properties pairs, firstEndpoint and siblingMethods of DependsOnMethod replaced with entries.
  • Consider the automated migration using the built-in ESLint rule.
// eslint.config.mjs — minimal ESLint 9 config to apply migrations automatically using "eslint --fix"
import parser from "@typescript-eslint/parser";
import migration from "express-zod-api/migration";

export default [
  { languageOptions: { parser }, plugins: { migration } },
  { files: ["**/*.ts"], rules: { "migration/v21": "error" } },
];
// The sample of new structure
const config = createConfig({
  http: { listen: 80 }, // became optional
  https: { listen: 443, options: {} },
  upload: true,
  compression: true,
  beforeRouting: ({ app, getLogger }) => {
    const logger = getLogger();
    app.use((req, res, next) => {
      const childLogger = getLogger(req);
    });
  },
});
const { servers } = await createServer(config, {});

Version 20

robintail
published 21.0.0-beta.6 •

robintail
published 20.22.1 •

Changelog

Source

v20.22.1

  • Avoids startup logo distortion when the terminal is too narrow;
  • Self-diagnosis for potential problems disabled in production mode to ensure faster startup:
    • Warning about potentially unserializable schema for JSON operating endpoints was introduced in v20.15.0.
robintail
published 21.0.0-beta.5 •

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc