Skip to content

Commit

Permalink
Resolve Numeric Constraint Reporting Error (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairzx81 authored Jun 27, 2023
1 parent 06f3c39 commit 3b6c984
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sinclair/typebox",
"version": "0.28.19",
"version": "0.28.20",
"description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",
"keywords": [
"typescript",
Expand Down
6 changes: 3 additions & 3 deletions src/errors/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export enum ValueErrorType {
NumberMultipleOf,
NumberExclusiveMinimum,
NumberExclusiveMaximum,
NumberMinumum,
NumberMinimum,
NumberMaximum,
Object,
ObjectMinProperties,
Expand Down Expand Up @@ -329,10 +329,10 @@ export namespace ValueErrors {
yield { type: ValueErrorType.NumberExclusiveMaximum, schema, path, value, message: `Expected number to be less than ${schema.exclusiveMaximum}` }
}
if (IsDefined<number>(schema.minimum) && !(value >= schema.minimum)) {
yield { type: ValueErrorType.NumberMaximum, schema, path, value, message: `Expected number to be greater or equal to ${schema.minimum}` }
yield { type: ValueErrorType.NumberMinimum, schema, path, value, message: `Expected number to be greater or equal to ${schema.minimum}` }
}
if (IsDefined<number>(schema.maximum) && !(value <= schema.maximum)) {
yield { type: ValueErrorType.NumberMinumum, schema, path, value, message: `Expected number to be less or equal to ${schema.maximum}` }
yield { type: ValueErrorType.NumberMaximum, schema, path, value, message: `Expected number to be less or equal to ${schema.maximum}` }
}
}
function* Object(schema: Types.TObject, references: Types.TSchema[], path: string, value: any): IterableIterator<ValueError> {
Expand Down

0 comments on commit 3b6c984

Please sign in to comment.