From f5d2c20cc4739b8930d2527f43977e07bd87f09f Mon Sep 17 00:00:00 2001 From: Manuel Spigolon Date: Thu, 6 Jan 2022 10:36:12 +0100 Subject: [PATCH] chore: add oneOf to docs --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7368d964..f4606ccd 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ compile-json-stringify date format x 1,086,187 ops/sec ±0.16% (99 runs sampled) - `Missing fields` - `Pattern Properties` - `Additional Properties` - - `AnyOf` + - `AnyOf` and `OneOf` - `Reuse - $ref` - `Long integers` - `Integers` @@ -320,11 +320,11 @@ const obj = { console.log(stringify(obj)) // '{"nickname":"nick","matchfoo":"42","otherfoo":"str","matchnum":3,"nomatchstr":"valar morghulis",nomatchint:"313"}' ``` -#### AnyOf +#### AnyOf and OneOf -`fast-json-stringify` supports the anyOf keyword as defined by JSON schema. *anyOf* must be an array of valid JSON schemas. The different schemas will be tested in the specified order. The more schemas `stringify` has to try before finding a match, the slower it will be. +`fast-json-stringify` supports the **anyOf** and **oneOf** keywords as defined by JSON schema. Both must be an array of valid JSON schemas. The different schemas will be tested in the specified order. The more schemas `stringify` has to try before finding a match, the slower it will be. -*anyOf* uses [ajv](https://www.npmjs.com/package/ajv) as a JSON schema validator to find the schema that matches the data. This has an impact on performance—only use it as a last resort. +*anyOf* and *oneOf* use [ajv](https://www.npmjs.com/package/ajv) as a JSON schema validator to find the schema that matches the data. This has an impact on performance—only use it as a last resort. Example: ```javascript