From 85dafb06947b4f8932d2d807350bf8ce4ce9e0f7 Mon Sep 17 00:00:00 2001 From: Jason Ian Green Date: Sun, 16 Jun 2024 14:17:45 +0100 Subject: [PATCH 1/5] fix: ignore new eslint error (#2455) --- lib/compile/codegen/code.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compile/codegen/code.ts b/lib/compile/codegen/code.ts index b17701973e..9d4de6149f 100644 --- a/lib/compile/codegen/code.ts +++ b/lib/compile/codegen/code.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-extraneous-class export abstract class _CodeOrName { abstract readonly str: string abstract readonly names: UsedNames From 8bccdc4d7c46c1a8e0dacc1c4e1cd317c20b3fe5 Mon Sep 17 00:00:00 2001 From: Jason Ian Green Date: Sun, 16 Jun 2024 14:22:14 +0100 Subject: [PATCH 2/5] docs: clarify behaviour of addVocabulary (#2454) As it's name is so different and not just `addKeywords`, there has been some confusion as to it's behaviour. --- docs/strict-mode.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/strict-mode.md b/docs/strict-mode.md index d067d9d5ab..5aed953efc 100644 --- a/docs/strict-mode.md +++ b/docs/strict-mode.md @@ -42,10 +42,10 @@ By default Ajv fails schema compilation when unknown keywords are used. Users ca ajv.addKeyword("allowedKeyword") ``` -or +or use the convenience method `addVocabulary` for multiple keywords ```javascript -ajv.addVocabulary(["allowed1", "allowed2"]) +ajv.addVocabulary(["allowed1", "allowed2"]) // simply calls addKeyword multiple times ``` #### Ignored "additionalItems" keyword From 603f63b291160ae02472184d30d408e8d7114af8 Mon Sep 17 00:00:00 2001 From: Nicholas Blott Date: Wed, 19 Jun 2024 23:45:57 +0200 Subject: [PATCH 3/5] docs: refactor to improve legibility (#2432) The use of "not more" with the reverse ordering of the sentence made this difficult to parse. After reversing the order and removing negation, the surrounding paragraphs were updated to match the style. Co-authored-by: Jason Ian Green --- docs/json-schema.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/json-schema.md b/docs/json-schema.md index c888c636d6..0b7659ef56 100644 --- a/docs/json-schema.md +++ b/docs/json-schema.md @@ -478,11 +478,11 @@ To create and equivalent schema in draft-2020-12 use keywords [prefixItems](#pre The value of the keyword should be a boolean or an object. -If `items` keyword is not present or it is an object, `additionalItems` keyword should be ignored regardless of its value. By default Ajv will throw exception in this case - see [Strict mode](./strict-mode.md) +`additionalItems` keyword is ignored if `items` keyword is not present or is an object. By default Ajv will throw exception in this case - see [Strict mode](./strict-mode.md) -If `items` keyword is an array and data array has not more items than the length of `items` keyword value, `additionalItems` keyword is also ignored. +`additionalItems` keyword is ignored if `items` keyword has more elements than data array. -If the length of data array is bigger than the length of "items" keyword value than the result of the validation depends on the value of `additionalItems` keyword: +If the data array has more elements than the `items` keyword value then the result of the validation depends on the value of `additionalItems` keyword: - `false`: data is invalid - `true`: data is valid From 650c7f6d6aa7e8a0608ad4196d674a2f2d2fa685 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Wed, 19 Jun 2024 23:58:07 +0200 Subject: [PATCH 4/5] Fix grammatical typo in managing-schemas.md (#2305) "there is many" -> "there are many" Co-authored-by: Jason Ian Green --- docs/guide/managing-schemas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/managing-schemas.md b/docs/guide/managing-schemas.md index eb007b5394..4c860755c9 100644 --- a/docs/guide/managing-schemas.md +++ b/docs/guide/managing-schemas.md @@ -186,7 +186,7 @@ In the example above, the key passed to the `addSchema` method was used to retri ### Pre-adding all schemas vs adding on demand -In the example above all schemas were added in advance. It is also possible, to add schemas as they are used - it can be helpful if there is many schemas. In this case, you need to check first whether the schema is already added by calling `getSchema` method - it would return `undefined` if not: +In the example above all schemas were added in advance. It is also possible, to add schemas as they are used - it can be helpful if there are many schemas. In this case, you need to check first whether the schema is already added by calling `getSchema` method - it would return `undefined` if not: ```javascript const schema_user = require("./schema_user.json") From a18641ef4ceb9623ea7c437e6f4f98d44ac293aa Mon Sep 17 00:00:00 2001 From: Alex B <17498057+alexanderjsx@users.noreply.github.com> Date: Sun, 30 Jun 2024 22:59:42 +0100 Subject: [PATCH 5/5] Update modifying-data.md - fix broken strict-mode link (#2459) --- docs/guide/modifying-data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/modifying-data.md b/docs/guide/modifying-data.md index 2705c0bedf..5b1d893bd3 100644 --- a/docs/guide/modifying-data.md +++ b/docs/guide/modifying-data.md @@ -210,7 +210,7 @@ With `useDefaults` option `default` keywords throws exception during schema comp The strict mode option can change the behaviour for these unsupported defaults (`strict: false` to ignore them, `"log"` to log a warning). -See [Strict mode](./strict-mode.md). +See [Strict mode](../strict-mode.md). ::: tip Default with discriminator keyword Defaults will be assigned in schemas inside `oneOf` in case [discriminator](../json-schema.md#discriminator) keyword is used.