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
432
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.0.0

Diff

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 •

robintail
published 20.22.0 •

Changelog

Source

v20.22.0

  • Featuring a helper to describe nested Routing for already assigned routes:
    • Suppose you want to describe Routing for both /v1/path and /v1/path/subpath routes having Endpoints attached;
    • Previously, an empty path segment was proposed for that purpose, but there is more elegant and readable way now;
    • The .nest() method is available both on Endpoint and DependsOnMethod instances:
import { Routing } from "express-zod-api";

// Describing routes /v1/path and /v1/path/subpath both having endpoints assigned:
const before: Routing = {
  v1: {
    path: {
      "": endpointA,
      subpath: endpointB,
    },
  },
};

const after: Routing = {
  v1: {
    path: endpointA.nest({
      subpath: endpointB,
    }),
  },
};
robintail
published 21.0.0-beta.4 •

robintail
published 20.21.2 •

Changelog

Source

v20.21.2

  • Fixed the example implementation in the generated client for endpoints using path params:
    • The choice of parser was made based on the exported const jsonEndpoints indexed by path;
    • The actual path used for the lookup already contained parameter substitutions so that JSON parser didn't work;
    • The new example implementation suggests choosing the parser based on the actual response.headers;
    • The issue was found and reported by @HenriJ.
- const parser = `${method} ${path}` in jsonEndpoints ? "json" : "text";
+ const isJSON = response.headers
+   .get("content-type")
+   ?.startsWith("application/json");
- return response[parser]();
+ return response[isJSON ? "json" : "text"]();
robintail
published 21.0.0-beta.3 •

robintail
published 20.21.1 •

Changelog

Source

v20.21.1

  • Performance tuning: Routing traverse made about 12 times faster.
robintail
published 21.0.0-beta.2 •

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