Skip to content

Commit 4f271e7

Browse files
committed
Publish 2.0.0-rc.1
1 parent d833117 commit 4f271e7

File tree

4 files changed

+234
-32
lines changed

4 files changed

+234
-32
lines changed

.npm/package/npm-shrinkwrap.json

+178-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

+37-29
Original file line numberDiff line numberDiff line change
@@ -88,35 +88,43 @@ A simple, reactive schema validation smart package for Meteor.
8888

8989
### 2.0.0
9090

91-
- You must now `import { SimpleSchema } from 'meteor/aldeed:simple-schema';` wherever you use `SimpleSchema`
92-
- `SimpleSchemaValidationContext` is now `SimpleSchema.ValidationContext`
93-
- If you prefer keys to be optional by default, you can pass `requiredByDefault: false` as a SimpleSchema constructor option and then use `required: true` for each key that should be required.
94-
- Implicit keys are no longer added for you. You must define every key. The one exception is array items when using shorthand (see next change)
95-
- You can now use shorthand for keys when your schema is extra super duper simple. See "Shorthand Syntax" in the README.
96-
- `validationContext.resetValidation()` is renamed to `validationContext.reset()`
97-
- `validationContext.removeInvalidKeys()` has been removed since it is effectively the same as `validationContext.reset()`.
98-
- Removed `validationContext.getErrorObject()` since the `ValidationError` thrown by `simpleSchema.validate()` fills this need.
99-
- A `SimpleSchema` can no longer be used with the `check` package `check` function. Instead, use `simpleSchema.validate()`, which throws a more helpful ValidationError and satisfies `audit-argument-checks`.
100-
- `validationContext.validateOne()` is removed and instead you can pass a `keys` array as an option to `validationContext.validate()`
101-
- `invalidKeys()` is changed to `validationErrors()`, `_invalidKeys` is changed to `_validationErrors`, and `addInvalidKeys` is changed to `addValidationErrors`
102-
- The error objects returned by `validationErrors()` and attached to thrown `ValidationError` objects now have additional properties that help describe the particular error.
103-
- `decimal` is no longer a valid schema option. Instead, decimal/float is the default, and you can set the `type` to `SimpleSchema.Integer` to specify that you want only integers.
104-
- In custom validation functions, you can now do `this.addValidationErrors(errors)`, where errors is an array of error objects. This allows you to add errors for keys other than the one you are validating.
105-
- The `SimpleSchema.ErrorTypes` object now contains constants for all of the built-in error type strings.
106-
- If you returned the error strings "expectedString", "expectedNumber", "expectedBoolean", "expectedArray", "expectedObject", or "expectedConstructor" prior to 2.0, you should now return SimpleSchema.ErrorTypes.EXPECTED_TYPE instead.
107-
- Error message changes:
108-
- SimpleSchema now uses `MessageBox` to manage validation error messages. Among other things, this means that placeholder text should now use handlebars syntax, `{{label}}` instead of `[label]`
109-
- In the message context (for placeholders), `[type]` is now `{{dataType}}` and `[key]` is now `{{name}}`, though `key` still works for now.
110-
- `SimpleSchema.messages` is removed. You can call `MessageBox.defaults` directly instead.
111-
- `SimpleSchema.prototype.messages` is removed. You can call `simpleSchemaInstance.messageBox.messages()` instead, and you must pass in the messages in the format required by that package.
112-
- `SimpleSchema._globalMessages` and `SimpleSchema._depsGlobalMessages` internal properties are removed.
113-
- If you have custom regEx messages, you now need to do this by overriding the `regEx` messages function.
114-
- SimpleSchema constructor no longer accepts an array to merge schemas. Instead, pass a single schema and then use `schema.extend(otherSchema)` to extend it.
115-
- When validating, objects with a custom prototype were previously treated as blackbox objects. Now they are validated by default, so you must add `blackbox: true` to your schema if you want to keep the old behavior. The exceptions are Date objects and TypedArray objects, which are always treated as blackbox.
116-
- You can now specify multiple combinations of type and certain other validation criteria for a single field. This is done using `SimpleSchema.oneOf`. Refer to the documentation for details.
117-
- Cleaning an object no longer mutates it. However, you can pass `mutate: true` option to improve performance if you don't mind the object being mutated.
118-
- You can now add custom whole-document validators, either globally or for one schema. See `SimpleSchema.addDocValidator` and `simpleSchemaInstance#addDocValidator`.
119-
- If you pass an array of objects to `simpleSchemaInstance#validate`, all objects will be validated, and an error will be thrown for the first invalid object.
91+
- SimpleSchema is now primarily an NPM package located here: https://github.com/aldeed/node-simple-schema The Meteor package will continue to be published and will make Meteor-specific adjustments as necessary, but you should attempt to migrate to using the NPM package directly as soon as you can.
92+
- You should now `import { SimpleSchema } from 'meteor/aldeed:simple-schema'` (Meteor package) or `import SimpleSchema from 'simpl-schema'` (NPM package) in every file where you use `SimpleSchema`.
93+
- Renamed:
94+
- `SimpleSchemaValidationContext` -> `SimpleSchema.ValidationContext`
95+
- `validationContext.resetValidation()` -> `validationContext.reset()`
96+
- `validationContext.invalidKeys()` -> `validationContext.validationErrors()`
97+
- `validationContext.addInvalidKeys()` -> `validationContext.addValidationErrors()`
98+
- Removed:
99+
- `validationContext.removeInvalidKeys()`: It was effectively the same as `validationContext.reset()`.
100+
- `validationContext.getErrorObject()`: The `ValidationError` thrown by `simpleSchema.validate()` fills this need.
101+
- `validationContext.validateOne()`: Instead you can pass a `keys` array as an option to `validationContext.validate()`.
102+
- Other Breaking Changes:
103+
- `decimal` is no longer a valid schema option. Instead, decimal/float is the default, and you can set the `type` to `SimpleSchema.Integer` to specify that you want only integers.
104+
- Error message changes:
105+
- SimpleSchema now uses `MessageBox` to manage validation error messages. Among other things, this means that placeholder text should now use handlebars syntax, `{{label}}` instead of `[label]`
106+
- In the message context (for placeholders), `[type]` is now `{{dataType}}` and `[key]` is now `{{name}}`, though `key` still works for now.
107+
- `SimpleSchema.messages` is removed. You can call `MessageBox.defaults` directly instead.
108+
- `SimpleSchema.prototype.messages` is removed. You can call `simpleSchemaInstance.messageBox.messages()` instead, and you must pass in the messages in the format required by that package.
109+
- `SimpleSchema._globalMessages` and `SimpleSchema._depsGlobalMessages` internal properties are removed.
110+
- If you have custom regEx messages, you now need to do this by overriding the `regEx` messages function.
111+
- SimpleSchema constructor no longer accepts an array to merge schemas. Instead, pass a single schema and then use `schema.extend(otherSchema)` to extend it.
112+
- When validating, objects with a custom prototype were previously treated as blackbox objects. Now they are validated by default, so you must add `blackbox: true` to your schema if you want to keep the old behavior. The exceptions are Date objects and TypedArray objects, which are always treated as blackbox.
113+
- The internal storage of your schema object has changed, so calling `simpleSchemaInstance.schema()` will now return an object that looks different. One of the differences is that subschemas are not merged into it. To get an object with subschemas merged, you can call `simpleSchemaInstance.mergedSchema()`. However, there are still differences due to how groups/`oneOf` is handled internally.
114+
- Implicit keys are no longer added for you. You must define every key.
115+
- A `SimpleSchema` can no longer be used with the `check` package `check` function. Instead, use `simpleSchema.validate()`, which throws a more helpful ValidationError and satisfies `audit-argument-checks`.
116+
- If you have custom validation that returns the error strings "expectedString", "expectedNumber", "expectedBoolean", "expectedArray", "expectedObject", or "expectedConstructor", you should now return `{ type: SimpleSchema.ErrorTypes.EXPECTED_TYPE, dataType: 'String' }` instead, where `dataType` is "Boolean", "String", "Object", "Array", "Integer", or "Number".
117+
- Cleaning an object no longer mutates it. However, you can pass `mutate: true` option to improve performance if you don't mind the object being mutated.
118+
- Reactivity of labels and error messages in client code is no longer automatic. When creating your `SimpleSchema` instance, pass `{ tracker: Tracker }` in the options to enable Tracker reactivity.
119+
- New Features
120+
- If you prefer keys to be optional by default, you can pass `requiredByDefault: false` as a SimpleSchema constructor option and then use `required: true` for each key that should be required.
121+
- You can now use shorthand for keys when your schema is extra super duper simple. See https://github.com/aldeed/node-simple-schema#shorthand-definitions
122+
- The error objects returned by `validationErrors()` and attached to thrown `ValidationError` objects now have additional properties that help describe the particular error.
123+
- In custom validation functions, you can now do `this.addValidationErrors(errors)`, where errors is an array of error objects. This allows you to add errors for keys other than the one you are validating.
124+
- The `SimpleSchema.ErrorTypes` object now contains constants for all of the built-in error type strings.
125+
- You can now specify multiple combinations of type and certain other validation criteria for a single field. This is done using `SimpleSchema.oneOf`. Refer to https://github.com/aldeed/node-simple-schema#multiple-definitions-for-one-key
126+
- You can now add custom whole-document validators, either globally or for one schema. See `SimpleSchema.addDocValidator` and `simpleSchemaInstance#addDocValidator`.
127+
- If you pass an array of objects to `simpleSchemaInstance#validate`, all objects will be validated, and an error will be thrown for the first invalid object.
120128

121129
### 1.4.0
122130

package.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Package.describe({
66
});
77

88
Npm.depends({
9-
'simpl-schema': '0.0.1'
9+
'simpl-schema': '0.0.3'
1010
});
1111

1212
Package.onUse(function(api) {
@@ -19,6 +19,9 @@ Package.onUse(function(api) {
1919
]);
2020

2121
api.mainModule('main.js');
22+
23+
// Need this for backwards compatibility for now
24+
api.export('SimpleSchema');
2225
});
2326

2427
// Package.onTest(function(api) {

0 commit comments

Comments
 (0)