Skip to content

Commit

Permalink
refactor(*): Add custom message options to all shapes and validators
Browse files Browse the repository at this point in the history
- ci: add codecov file and update testing config
- refactor: pass options down to all methods and update error names
- ci: fix testing in workflow
- fix: fix tuple shape
- test: update all existing tests to pass again
- test: change magic number for constant
- ci: ensure tests can run in parallel with builds
- ci: change to yarnpkg registry
- ci: fix test parallelization
- test: output coverage as cobertura instead of clover
- chore: create patch out of changes for `esbuild-plugins-node-modules-polyfill`
- chore: cleanup package.json
- feat: pass options through to everything
- refactor: use original type location
- fix: add validator options to when
- fix: fixed argument order for cloning union validator
- docs: expand breaking changes list
- refactor: make `BaseValidator.validatorOptions` protected

BREAKING CHANGE: Most shapes and validators that were previously getters are now functions to allow for custom options. The following list should show all of the changes, but if we have forgot any and you get an error saying something should be a function where you have provided a constant it is safe to assume you simply need to add `()` to your code for it to work again.
BREAKING CHANGE: `NonNullObject` utility type has been removed.
BREAKING CHANGE: `PickDefined` utility type has been removed.
BREAKING CHANGE: `PickUndefinedMakeOptional` utility type has been removed.
BREAKING CHANGE: `s.any` is now `s.any()` to allow for custom options as argument.
BREAKING CHANGE: `s.array.unique` is now `s.array.unique()` to allow for custom options as second argument.
BREAKING CHANGE: `s.array` is now `s.array()` to allow for custom options as argument.
BREAKING CHANGE: `s.bigint().abs` is now `s.bigint().abs()` to allow for custom options as second argument.
BREAKING CHANGE: `s.bigint().negative` is now `s.bigint().negative()` to allow for custom options as second argument.
BREAKING CHANGE: `s.bigint().positive` is now `s.bigint().positive()` to allow for custom options as second argument.
BREAKING CHANGE: `s.bigint` is now `s.bigint()` to allow for custom options as argument.
BREAKING CHANGE: `s.bigInt64Array` is now `s.bigInt64Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.bigUint64Array` is now `s.bigUint64Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.boolean.false` is now `s.boolean().false()` to allow for custom options as second argument.
BREAKING CHANGE: `s.boolean.true` is now `s.boolean().true()` to allow for custom options as second argument.
BREAKING CHANGE: `s.boolean` is now `s.boolean()` to allow for custom options as argument.
BREAKING CHANGE: `s.date.invalid` is now `s.date().invalid()` to allow for custom options as second argument.
BREAKING CHANGE: `s.date.valid` is now `s.date().valid()` to allow for custom options as second argument.
BREAKING CHANGE: `s.date` is now `s.date()` to allow for custom options as argument.
BREAKING CHANGE: `s.enum(1, 2, 3)` is now `s.enum([1, 2, 3])` to allow for custom options as second argument.
BREAKING CHANGE: `s.float32Array` is now `s.float32Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.float64Array` is now `s.float64Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.int16Array` is now `s.int16Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.int32Array` is now `s.int32Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.int8Array` is now `s.int8Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.never` is now `s.never()` to allow for custom options as argument.
BREAKING CHANGE: `s.null` is now `s.null()` to allow for custom options as argument.
BREAKING CHANGE: `s.nullable` is now `s.nullable()` to allow for custom options as argument.
BREAKING CHANGE: `s.nullish` is now `s.nullish()` to allow for custom options as argument.
BREAKING CHANGE: `s.nullish` is now `s.nullish()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.abs` is now `s.number().abs()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.ceil` is now `s.number().ceil()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.finite` is now `s.number().finite()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.floor` is now `s.number().floor()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.fround` is now `s.number().fround()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.int` is now `s.number().int()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.negative` is now `s.number().negative()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.positive` is now `s.number().positive()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.round` is now `s.number().round()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.safeInt` is now `s.number().safeInt()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.sign` is now `s.number().sign()` to allow for custom options as argument.
BREAKING CHANGE: `s.number.trunc` is now `s.number().trunc()` to allow for custom options as argument.
BREAKING CHANGE: `s.number` is now `s.number()` to allow for custom options as argument.
BREAKING CHANGE: `s.object.ignore` is now `s.object().ignore()` to allow for custom options as argument.
BREAKING CHANGE: `s.object.partial` is now `s.object().partial()` to allow for custom options as argument.
BREAKING CHANGE: `s.object.passthrough` is now `s.object().passthrough()` to allow for custom options as argument.
BREAKING CHANGE: `s.object.required` is now `s.object().required()` to allow for custom options as argument.
BREAKING CHANGE: `s.object.strict` is now `s.object().strict()` to allow for custom options as argument.
BREAKING CHANGE: `s.optional` is now `s.optional()` to allow for custom options as argument.
BREAKING CHANGE: `s.set` is now `s.set()` to allow for custom options as argument.
BREAKING CHANGE: `s.string.date` is now `s.string().date()` to allow for custom options as argument.
BREAKING CHANGE: `s.string.email` is now `s.string().email()` to allow for custom options as argument.
BREAKING CHANGE: `s.string.ipv4` is now `s.string().ipv4()` to allow for custom options as argument.
BREAKING CHANGE: `s.string.ipv6` is now `s.string().ipv6()` to allow for custom options as argument.
BREAKING CHANGE: `s.string` is now `s.string()` to allow for custom options as argument.
BREAKING CHANGE: `s.tuple(1, 2, 3)` is now `s.tuple([1, 2, 3])` to allow for custom options as second argument.
BREAKING CHANGE: `s.uint16Array` is now `s.uint16Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.uint32Array` is now `s.uint32Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.uint8Array` is now `s.uint8Array()` to allow for custom options as argument.
BREAKING CHANGE: `s.uint8ClampedArray` is now `s.uint8ClampedArray()` to allow for custom options as argument.
BREAKING CHANGE: `s.undefined` is now `s.undefined()` to allow for custom options as argument.
BREAKING CHANGE: `s.union(1, 2, 3)` is now `s.union([1, 2, 3])` to allow for custom options as second argument.
BREAKING CHANGE: `s.unknown` is now `s.unknown()` to allow for custom options as argument.
BREAKING CHANGE: `uniqueArray` is now a function (instead of a constant) to allow for custom options as argument.
  • Loading branch information
favna committed Apr 10, 2023
1 parent c0ee864 commit 4841101
Show file tree
Hide file tree
Showing 87 changed files with 9,699 additions and 8,337 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-deprecate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
node-version: 16
cache: yarn
registry-url: https://registry.npmjs.org/
registry-url: https://registry.yarnpkg.org/
- name: Install Dependencies
run: yarn --immutable
- name: Deprecate versions
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
node-version: 18
cache: yarn
registry-url: https://registry.npmjs.org/
registry-url: https://registry.yarnpkg.org/
- name: Install Dependencies
run: yarn --immutable
- name: Run ESLint
Expand All @@ -37,7 +37,7 @@ jobs:
with:
node-version: 18
cache: yarn
registry-url: https://registry.npmjs.org/
registry-url: https://registry.yarnpkg.org/
- name: Install Dependencies
run: yarn --immutable
- name: Generate Documentation
Expand All @@ -60,11 +60,13 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: yarn
registry-url: https://registry.npmjs.org/
registry-url: https://registry.yarnpkg.org/
- name: Install Dependencies
run: yarn --immutable
- name: Typecheck And Build Code
run: yarn typecheck && yarn build
- name: Typecheck Code
run: yarn typecheck
- name: Build Code
run: yarn build
- name: Run tests
run: yarn test
- name: Codecov Upload ${{ matrix.node }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deprecate-on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
node-version: 16
cache: yarn
registry-url: https://registry.npmjs.org/
registry-url: https://registry.yarnpkg.org/
- name: Install Dependencies
run: yarn --immutable
- name: Deprecate versions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
node-version: 16
cache: yarn
registry-url: https://registry.npmjs.org/
registry-url: https://registry.yarnpkg.org/
- name: Install Dependencies
run: yarn --immutable
- name: Build Documentation
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"**/dist/": true,
"**/.git/": true
},
"cSpell.words": ["bortzmeyer", "fhqwhgads", "manisharaan", "midichlorians", "Pallas", "Plagueis"]
"cSpell.words": ["bortzmeyer", "fhqwhgads", "Jsonified", "manisharaan", "midichlorians", "Pallas", "Plagueis"]
}
340 changes: 259 additions & 81 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

155 changes: 155 additions & 0 deletions BREAKING_CHANGES.md

Large diffs are not rendered by default.

Loading

0 comments on commit 4841101

Please sign in to comment.