express-zod-api

A Typescript library to help you get an API server up and running with I/O schema validation and custom middlewares in minutes.

MIT License

Downloads
20.4K
Stars
612
Committers
9

Bot releases are hidden (Show)

express-zod-api - v20.2.0

Published by RobinTail 4 months ago

Feature

Fix (documentation)

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v20.1.0...v20.2.0

express-zod-api - v20.1.0

Published by RobinTail 4 months ago

Feature

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v20.0.1...v20.1.0

express-zod-api - v20.0.1

Published by RobinTail 4 months ago

express-zod-api - v20.0.0

Published by RobinTail 4 months ago

Version 20 is for Zoey

This version focuses on improving typing, consistency of methods and approaches, and simplifying the testing approach. A number of creator functions have been replaced with classes. Creating ResultHandlers and Middlewares has become more flexible. To eliminate frequent confusion, a new approach to endpoint testing has been applied: request and response mocking is completely detached from testing frameworks and works out of the box without any tricks. For the first time, an automatic migration is offered as an ESLint plugin, which itself adapts your code to this version.

Breaking changes (and features)

  • Method createLogger() removed — use new BuiltinLogger() instead if needed;
  • Method createResultHandler removed — use new ResultHandler() instead:
    • The argument's properties renamed: getPositiveResponse to positive and getNegativeResponse to negative;
    • Both properties can now accept static values (not only functions).
  • Method createMiddleware() removed — use either new Middleware() or EndpointsFactory::addMiddleware() instead:
    • The argument's property middleware renamed to handler.
  • Method testEndpoint() was changed:
    • It was detached from any testing frameworks, fnMethod property removed from the argument;
    • Mocked request and response are now fully operational and do not require to mock anything to do the job;
    • The responseProps property changed to responseOptions, it's no longer meant to be used for custom props;
    • The returned entities requestMock, responseMock and loggerMock no longer rely on testing framework for props.
      Instead, they provide methods to assert expectations in tests:

Migration

  • See the migration guide in Changelog;
  • Consider using the provided ESLint plugin migration in order to apply changes automatically (except assertions).
// eslint.config.mjs — minimal config to apply migrations automatically using "eslint . --fix" (at least ESLint 8)
import parser from "@typescript-eslint/parser";
import migration from "express-zod-api/migration";

export default [{ languageOptions: { parser }, files: ["**/*.ts"] }, migration];
express-zod-api - v19.2.3

Published by RobinTail 4 months ago

What's Changed

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v19.2.2...v19.2.3

express-zod-api - v19.2.2

Published by RobinTail 5 months ago

Fixes

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v19.2.1...v19.2.2

express-zod-api - v19.2.1 Latest Release

Published by RobinTail 5 months ago

What's Changed

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v19.2.0...v19.2.1

express-zod-api - v19.2.0

Published by RobinTail 5 months ago

Features

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v19.1.2...v19.2.0

express-zod-api - v18.6.3

Published by RobinTail 5 months ago

Fixes

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v18.6.2...v18.6.3

express-zod-api - v19.1.2

Published by RobinTail 5 months ago

Fixes

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v19.1.1...v19.1.2

express-zod-api - v19.1.1

Published by RobinTail 5 months ago

express-zod-api - v19.1.0

Published by RobinTail 5 months ago

What's Changed

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v19.0.0...v19.1.0

express-zod-api - v19.0.0

Published by RobinTail 5 months ago

Version 19 is for Dime

This version is focused on making express-zod-api a complete zod plugin. In this regard withMeta is removed in favor of the recommended approach on extending zod functionality, which opens up opportunities for new features and simplifies the consumer experience. Another improvement has been made for parsers: they are now applied selectively depending on the type of expected request.

Breaking changes

  • Increased the minimum supported versions:
    • For Node.js: 18.18.0, 20.9.0 or 22.0.0;
    • For zod: 3.23.0;
    • For express: 4.19.2;
    • For express-fileupload and @types/express-fileupload: 1.5.0.
  • Removed the deprecated method withMeta() (see v18.5.0 for details);
  • Removed support for static options by EndpointsFactory::addOptions() (see v18.6.0 for details);
  • Freezed the arrays returned by the methods or exposed by properties of Endpoint and DependsOnMethod;
  • Changed interface for ez.raw(): additional properties should be supplied as its argument, not via .extend();
  • Changed the following config options:
    • The function assigned to server.upload.beforeUpload now accepts request instead of app;
    • The function assigned to server.beforeRouting is now called before parsing too.

Features

  • New configurable level info for built-in logger (higher than debug, but lower than warn);
  • Selective parsers equipped with a child logger.

Migration

Find the migration guide in the Changelog

express-zod-api - v18.6.2

Published by RobinTail 5 months ago

Refactoring

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v18.6.1...v18.6.2

express-zod-api - v18.6.1

Published by RobinTail 5 months ago

  • Documentation update on using .addOptions with caution.

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v18.6.0...v18.6.1

express-zod-api - v18.6.0

Published by RobinTail 5 months ago

Feature

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v18.5.2...v18.6.0

express-zod-api - v18.5.2

Published by RobinTail 6 months ago

Changes

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v18.5.1...v18.5.2

express-zod-api - v18.5.1

Published by RobinTail 6 months ago

Changes

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v18.5.0...v18.5.1

express-zod-api - v18.5.0

Published by RobinTail 6 months ago

What's Changed

See the details in Changelog

express-zod-api - v18.4.0

Published by RobinTail 6 months ago

Features

Chores

Full Changelog: https://github.com/RobinTail/express-zod-api/compare/v18.3.0...v18.4.0