Skip to content

Commit

Permalink
Resolve Max Properties Error Message (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairzx81 authored Jul 18, 2023
1 parent b19575f commit 2bf9244
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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.29.5",
"version": "0.29.6",
"description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",
"keywords": [
"typescript",
Expand Down
4 changes: 2 additions & 2 deletions src/errors/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export namespace ValueErrors {
yield { type: ValueErrorType.ObjectMinProperties, schema, path, value, message: `Expected object to have at least ${schema.minProperties} properties` }
}
if (IsDefined<number>(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have less than ${schema.maxProperties} properties` }
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have no more than ${schema.maxProperties} properties` }
}
const requiredKeys = globalThis.Array.isArray(schema.required) ? schema.required : ([] as string[])
const knownKeys = globalThis.Object.getOwnPropertyNames(schema.properties)
Expand Down Expand Up @@ -391,7 +391,7 @@ export namespace ValueErrors {
yield { type: ValueErrorType.ObjectMinProperties, schema, path, value, message: `Expected object to have at least ${schema.minProperties} properties` }
}
if (IsDefined<number>(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have less than ${schema.minProperties} properties` }
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have no more than ${schema.maxProperties} properties` }
}
const [patternKey, patternSchema] = globalThis.Object.entries(schema.patternProperties)[0]
const regex = new RegExp(patternKey)
Expand Down

0 comments on commit 2bf9244

Please sign in to comment.