Skip to content

Commit 2bf9244

Browse files
authored
Resolve Max Properties Error Message (#502)
1 parent b19575f commit 2bf9244

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sinclair/typebox",
3-
"version": "0.29.5",
3+
"version": "0.29.6",
44
"description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",
55
"keywords": [
66
"typescript",

src/errors/errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export namespace ValueErrors {
342342
yield { type: ValueErrorType.ObjectMinProperties, schema, path, value, message: `Expected object to have at least ${schema.minProperties} properties` }
343343
}
344344
if (IsDefined<number>(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
345-
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have less than ${schema.maxProperties} properties` }
345+
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have no more than ${schema.maxProperties} properties` }
346346
}
347347
const requiredKeys = globalThis.Array.isArray(schema.required) ? schema.required : ([] as string[])
348348
const knownKeys = globalThis.Object.getOwnPropertyNames(schema.properties)
@@ -391,7 +391,7 @@ export namespace ValueErrors {
391391
yield { type: ValueErrorType.ObjectMinProperties, schema, path, value, message: `Expected object to have at least ${schema.minProperties} properties` }
392392
}
393393
if (IsDefined<number>(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
394-
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have less than ${schema.minProperties} properties` }
394+
yield { type: ValueErrorType.ObjectMaxProperties, schema, path, value, message: `Expected object to have no more than ${schema.maxProperties} properties` }
395395
}
396396
const [patternKey, patternSchema] = globalThis.Object.entries(schema.patternProperties)[0]
397397
const regex = new RegExp(patternKey)

0 commit comments

Comments
 (0)