Skip to content

Releases: codecoolture/next-joi

v2.2.1

05 Apr 15:17
Compare
Choose a tag to compare
  • Update peerDependencies to make the package compatible with Next 10 and onwards (#6)

v2.2.0

07 Mar 19:43
Compare
Choose a tag to compare

✨ New

The onValidationError function will now receive the validation error coming from Joi as a third parameter!

import withJoi from "next-joi";

export default withJoi({
  onValidationError: (req, res, error) => {
    return res.status(400).end();
  },
});

v2.1.1

29 Jan 19:40
Compare
Choose a tag to compare

This is just @sergioalvz fighting against the NPM registry 😄

v2.1.0

✨ New

The validation function has now support to check the headers property from the incoming request!

import Joi from "joi";
import withJoi from "next-joi";

const validate = withJoi({
  onValidationError: (_, res) => {
    return res.status(400).end();
  },
});

export default validate(
  {
    headers: Joi.object({
      "accept-language": Joi.string().valid("en"),
    }).unknown(),
  },
  (req, res) => {
    // This function will be only executed if the incoming request complies
    // with the validation schema defined above.
  }
);

v2.1.0

29 Jan 19:29
Compare
Choose a tag to compare

✨ New

The validation function has now support to check the headers property from the incoming request!

import Joi from "joi";
import withJoi from "next-joi";

const validate = withJoi({
  onValidationError: (_, res) => {
    return res.status(400).end();
  },
});

export default validate(
  {
    headers: Joi.object({
      "accept-language": Joi.string().valid("en"),
    }).unknown(),
  },
  (req, res) => {
    // This function will be only executed if the incoming request complies
    // with the validation schema defined above.
  }
);

v2.0.0

20 Nov 11:00
Compare
Choose a tag to compare

Breaking Changes

This version includes breaking changes. The default export is now a factory function that can be configured to have custom error handling for validation errors. The README.md has been updated accordingly to reflect the new behavior.

import withJoi from "next-joi";

export default withJoi({
  onValidationError: (_, res) => {
    return res.status(400).end();
  },
});

v1.0.0

06 Aug 15:19
Compare
Choose a tag to compare
Public release :rocket: