From 57a4172ee84ef0121b1944658dbddefa8c6de20e Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Sun, 9 Jul 2023 22:18:43 +0200 Subject: [PATCH] Move design details to roadmap Signed-off-by: Cristian Le --- README.md | 36 ------------------------------------ docs/index.md | 1 + docs/roadmap.md | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 36 deletions(-) create mode 100644 docs/roadmap.md diff --git a/README.md b/README.md index 6088723..79d0d4c 100644 --- a/README.md +++ b/README.md @@ -13,42 +13,6 @@ Niels Lohmann et al develop a great JSON parser for C++ called [JSON for Modern C++](https://github.com/nlohmann/json). This validator is based on this library, hence the name. -## Design goals - -The main goal of this validator is to produce *human-comprehensible* error -messages if a JSON-document/instance does not comply to its schema. - -By default this is done with exceptions thrown at the users with a helpful -message telling what's wrong with the document while validating. - -Starting with **2.0.0** the user can pass a `json_schema::basic_error_handler`-derived -object along with the instance to validate to receive a callback each time -a validation error occurs and decide what to do (throwing, counting, collecting). - -Another goal was to use Niels Lohmann's JSON-library. This is why the validator -lives in his namespace. - -## Thread-safety - -Instance validation is thread-safe and the same validator-object can be used by -different threads: - -The validate method is `const` which indicates the object is not modified when -being called: - -```C++ - json json_validator::validate(const json &) const; -``` - -Validator-object creation however is not thread-safe. A validator has to be -created in one (main?) thread once. - -## Weaknesses - -Numerical validation uses nlohmann-json's integer, unsigned and floating point -types, depending on if the schema type is "integer" or "number". Bignum -(i.e. arbitrary precision and range) is not supported at this time. - ## Building This library is based on Niels Lohmann's JSON-library and thus has diff --git a/docs/index.md b/docs/index.md index ef50137..dfa05c5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,6 +10,7 @@ hidden: true --- CONTRIBUTING changelog +roadmap ::: :::{include} ../README.md diff --git a/docs/roadmap.md b/docs/roadmap.md new file mode 100644 index 0000000..5af0441 --- /dev/null +++ b/docs/roadmap.md @@ -0,0 +1,37 @@ +# Roadmap + +## Design goals + +The main goal of this validator is to produce *human-comprehensible* error +messages if a JSON-document/instance does not comply to its schema. + +By default this is done with exceptions thrown at the users with a helpful +message telling what's wrong with the document while validating. + +Starting with **2.0.0** the user can pass a `json_schema::basic_error_handler`-derived +object along with the instance to validate to receive a callback each time +a validation error occurs and decide what to do (throwing, counting, collecting). + +Another goal was to use Niels Lohmann's JSON-library. This is why the validator +lives in his namespace. + +## Thread-safety + +Instance validation is thread-safe and the same validator-object can be used by +different threads: + +The validate method is `const` which indicates the object is not modified when +being called: + +```C++ + json json_validator::validate(const json &) const; +``` + +Validator-object creation however is not thread-safe. A validator has to be +created in one (main?) thread once. + +## Weaknesses + +Numerical validation uses nlohmann-json's integer, unsigned and floating point +types, depending on if the schema type is "integer" or "number". Bignum +(i.e. arbitrary precision and range) is not supported at this time.