Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9.0.0 Release Notes #920

Closed
Marsup opened this issue Jun 11, 2016 · 0 comments
Closed

9.0.0 Release Notes #920

Marsup opened this issue Jun 11, 2016 · 0 comments
Assignees
Labels
breaking changes Change that can breaking existing code release notes Major release documentation
Milestone

Comments

@Marsup
Copy link
Collaborator

Marsup commented Jun 11, 2016

Summary

This release breaks a few minor things and more importantly introduces extensibility to allow you to write your own rules (synchronous for now).

  • Upgrade time: low to none
  • Complexity: low
  • Risk: low

Breaking changes

Local options

label, raw and error in options are not supported anymore, you will have to use the already existing methods to change those behaviors.

This is the side effect of a performance improvement aiming at keeping options concerning a single schema local to it, options are meant to be inherited in the whole hierarchy of schemas, I consider those features don't have any meaningful use being inherited.

The upside of this change is that you will have much better performance when using labels.

In brief, this means that :

const schema = Joi.any().options({ 
  language: {
    label: 'mylabel'
  },
  raw: true,
  error: new Error('that failed')
});

// becomes

const schema = Joi.any().label('mylabel').raw().error(new Error('that failed');

Boolean

0 and 1 (as numbers or as strings) are now also accepted as inputs for booleans when convert is true.

Date

Using date().format() used to throw errors with code date.base, now it's date.format.

Internals

Joi now uses one more ES6 feature, that is classes. This should not impact any of you using node, but might for those of you that transpile Joi to run it into browsers.

New features

Joi.extend()

This is the new API to extend Joi, or rather make new custom versions of Joi. This would be pretty pointless to copy the documentation so I'll let you read it in place.

Contributors

The contributors to this release are @tjsail33 and myself.

Special thanks to the few who gave me feedback during the RFC and beta phase of the extend feature.

@Marsup Marsup added breaking changes Change that can breaking existing code release notes Major release documentation labels Jun 11, 2016
@Marsup Marsup added this to the 9.0.0 milestone Jun 11, 2016
@Marsup Marsup self-assigned this Jun 11, 2016
@Marsup Marsup changed the title [WIP] 9.0.0 Release Notes 9.0.0 Release Notes Jul 9, 2016
@Marsup Marsup closed this as completed Jul 9, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking changes Change that can breaking existing code release notes Major release documentation
Projects
None yet
Development

No branches or pull requests

1 participant