diff --git a/README.md b/README.md index ae47b38..449f38e 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Let's explore an example of our schema for a typical JSON API response containin } } ``` -In the above example, two types of constraint or rule descriptors are used: constraint functions (also known as validation functions, such as `@range(1, 10000)`) and constraint data types (also known as validation data types, such as `#integer`). All constraint functions begin with the `@` symbol, while all constraint data types start with `#`. C-style comments are also permitted in the schema. Please note that `address` can be `null` (eg. an optional input for users) and if it is `null` then no constraints of `address` are applicable. The following JSON is one of the examples which can successfully validate against the above schema. To start your journey with the JSON validation library, please consult the documentation available [here](https://relogiclabs.github.io/JsonSchema-Java/articles/intro). +In the above example, two types of constraints are used: constraint functions (also referred to as validation functions, such as `@range(1, 10000)`) and constraint data types (also referred to as validation data types, such as `#integer`). All constraint functions begin with the `@` symbol, while all constraint data types start with `#`. C-style comments are also supported within the schema. In this example, `address` can be `null` (like an optional input for users) and if it is `null` then no constraints of `address` are applicable. The following JSON is one of the examples that will be successfully validated against the above schema. To start your journey with the JSON validation library, please consult the documentation available [here](https://relogiclabs.github.io/JsonSchema-Java/articles/intro). ```json { "user": { @@ -130,7 +130,7 @@ The next example represents an expanded version of the previous one, which bring } } ``` -The subsequent JSON sample is an illustrative example that successfully validates against the expanded schema mentioned earlier. Within this example, recurring JSON structure appear that can be validated through defining components. By reusing defined components, you can achieve a clear and concise schema when validating large JSON with repetitive structures instead of duplicating large and complex validation constraints across the schema. This improves the overall readability and maintainability of the schema. +The subsequent JSON sample is an illustrative example that successfully validates against the expanded schema mentioned earlier. Within this example, recurring JSON structures appear that can be validated by defining components or nested functions and data types. Besides, reusing simple component definitions, you can achieve a clear and concise schema when validating large JSON with repetitive structures instead of duplicating or referring to various structures across the schema. This improves the overall readability and maintainability of the schema. ```json { "user": { @@ -219,4 +219,4 @@ The subsequent JSON sample is an illustrative example that successfully validate } } ``` -For more information about the schema syntax format and library functionalities, please refer to the reference documentation [here](https://relogiclabs.github.io/JsonSchema-Java/api/index.html). \ No newline at end of file +For more information about the schema syntax format and library functionalities, please refer to the reference documentation [here](https://relogiclabs.github.io/JsonSchema-Java/api/index.html). diff --git a/doc/content/articles/datetime.md b/doc/content/articles/datetime.md index 0f7dd02..5ab455e 100644 --- a/doc/content/articles/datetime.md +++ b/doc/content/articles/datetime.md @@ -11,46 +11,49 @@ Date and time formats are defined using date and time pattern strings. Within th Below, you will find a list of pattern letters and strings that are defined for date and time patterns. Please note that any characters within the 'A' to 'Z' and 'a' to 'z' range are reserved and should not be directly included in the pattern string. -| Pattern | Description | Example | -|---------|---------------------------------------|---------| -| G | Era period designator | AD | -| YYYY | Four digit year number | 1970 | -| YY | Two digit year number | 70 | -| MM | Month number in year (2 digit form) | 01 | -| MMMM | Full name of month | January | -| MMM | Short name of month | Jan | -| M | Month number in year (1-2 digit form) | 1, 01 | -| DDDD | Full name of day in week | Monday | -| DDD | Short name of day in week | Mon | -| DD | Day in month (2 digit form) | 01 | -| D | Day in month (1-2 digit form) | 1, 01 | -| t | AM/PM designator | AM, PM | -| hh | Hour in day (2 digit form) | 01, 12 | -| h | Hour in day (1-2 digit form) | 1, 01 | -| mm | Minute in hour (2 digit form) | 01, 20 | -| m | Minute in hour (1-2 digit form) | 1, 01 | -| ss | Second in minute (2 digit form) | 1, 01 | -| s | Second in minute (1-2 digit form) | 1, 01 | -| f | Tenths of a second | 1 | -| ff | Hundredths of a second | 11 | -| fff | Milliseconds of a second | 111 | -| ffff | Ten thousandths of a second | 1111 | -| fffff | Hundred thousandths of a second | 11111 | -| ffffff | Millionths of a second | 111111 | -| F | Fraction of a second upto 6 digits | 1, 111 | +| SN | Pattern | Description | Example | +|----|----------|---------------------------------------|-------------------------| +| 1 | `G` | Era period designator | `AD` | +| 2 | `YYYY` | Four digit year number | `1970` | +| 3 | `YY` | Two digit year number | `70` | +| 4 | `MM` | Month number in year (2 digit form) | `01` | +| 5 | `MMMM` | Full name of month | `January` | +| 6 | `MMM` | Short name of month | `Jan` | +| 7 | `M` | Month number in year (1-2 digit form) | `1`; `01` | +| 8 | `DDDD` | Full name of day in week | `Monday` | +| 9 | `DDD` | Short name of day in week | `Mon` | +| 10 | `DD` | Day in month (2 digit form) | `01` | +| 11 | `D` | Day in month (1-2 digit form) | `1`; `01` | +| 12 | `t` | AM/PM designator | `AM`; `PM` | +| 13 | `hh` | Hour in day (2 digit form) | `01`; `12` | +| 14 | `h` | Hour in day (1-2 digit form) | `1`; `01` | +| 15 | `mm` | Minute in hour (2 digit form) | `01`; `20` | +| 16 | `m` | Minute in hour (1-2 digit form) | `1`; `01` | +| 17 | `ss` | Second in minute (2 digit form) | `01`; `30` | +| 18 | `s` | Second in minute (1-2 digit form) | `1`; `01` | +| 19 | `f` | Tenths of a second | `1` | +| 20 | `ff` | Hundredths of a second | `11` | +| 21 | `fff` | Milliseconds of a second | `111` | +| 22 | `ffff` | Ten thousandths of a second | `1111` | +| 23 | `fffff` | Hundred thousandths of a second | `11111` | +| 24 | `ffffff` | Millionths of a second | `111111` | +| 25 | `F` | Fraction of a second upto 6 digits | `1`; `111`; `111111` | +| 26 | `Z` | Time zone hours only offset | `+06`; `-05`; `Z` | +| 27 | `ZZ` | Time zone hours and minutes offset | `+09:30`; `−03:30`; `Z` | +| 28 | `ZZZ` | Time zone hours and minutes offset | `+0930`; `−0330`; `Z` | The pattern components listed above can be combined to create comprehensive and customized date and time patterns to accommodate all system and user requirements. The following table illustrates some examples of how different date-time pattern components can be combined. -| Combined Pattern | Example | -|-----------------------------|-------------------------------| -| YYYY-MM-DD | 2023-09-01 | -| YYYY-MM-DD'T'hh:mm:ss.fffZZ | 2023-09-01T14:35:10.123+06:00 | -| MMMM DD, YYYY G | January 01, 1980 AD | -| DDDD, D MMMM YYYY | Tuesday, 11 July 2023 | -| YYYY.MM.DD hh.mm.ss t | 1980.11.21 10.30.50 pm | -| DDD, D MMM YY hh:mm:ss ZZ | Sun, 4 Jul 99 12:08:56 -06:00 | -| hh:mm:ss t ZZ | 03:11:30 AM +06:00 | +| SN | Usage | Combined Pattern | Example | +|----|---------|-----------------------------|---------------------------------| +| 1 | `#date` | `YYYY-MM-DD` | `2023-09-01` | +| 2 | `#time` | `YYYY-MM-DD'T'hh:mm:ss.FZZ` | `2023-09-01T14:35:10.111+06:00` | +| 3 | `@date` | `MMMM DD, YYYY G` | `January 01, 1980 AD` | +| 4 | `@date` | `DDDD, D MMMM YYYY` | `Tuesday, 11 July 2023` | +| 5 | `@time` | `YYYY.MM.DD hh.mm.ss t` | `1980.11.21 10.30.50 pm` | +| 6 | `@time` | `DDD, D MMM YY hh:mm:ss ZZ` | `Sun, 4 Jul 99 12:08:56 -06:00` | +| 7 | `@time` | `hh:mm:ss t ZZ` | `03:11:30 AM +06:00` | -The first pattern in the table above adheres to the ISO 8601 date format and is used to validate the `#date` data type within the schema. The second pattern in the table follows the ISO 8601 format for date and time, validating the `#time` data type in the schema. Instead of explicitly specifying these patterns in the `@date` or `@time` functions, a more concise approach is to directly utilize the `#date` or `#time` type within the schema. +The first pattern in the table above adheres to the ISO 8601 date format and is used to validate the `#date` data type within the schema. The second pattern in the table follows the ISO 8601 format for date and time, validating the `#time` data type in the schema. Instead of explicitly specifying these patterns in the `@date` or `@time` functions, a more concise approach is to directly utilize the `#date` or `#time` type within the schema. Detailed explanations regarding the date and time format of the ISO 8601 standard are available in this [document](https://www.iso.org/iso-8601-date-and-time-format.html). -When the AM/PM designator is included in the date and time pattern, the presence of any hour format specifier indicates that the time is in the 12-hour clock format. Conversely, when the AM/PM designator is omitted, the presence of any hour format specifier indicates that the time is in the 24-hour clock format. \ No newline at end of file +When the AM/PM designator is included in the date and time pattern, the presence of any hour format specifier indicates that the time is in the 12-hour clock format. Conversely, when the AM/PM designator is omitted, the presence of any hour format specifier indicates that the time is in the 24-hour clock format. diff --git a/doc/content/articles/quickstart.md b/doc/content/articles/quickstart.md index b5e7522..45482f1 100644 --- a/doc/content/articles/quickstart.md +++ b/doc/content/articles/quickstart.md @@ -1,11 +1,11 @@ +++ title = 'Quick Start' -date = 2023-10-08T09:38:53+06:00 +date = 2023-11-03T09:38:53+06:00 weight = 2 +++ # Getting Started -This guide will walk you through the essential steps to quickly get up and running with New JSON Schema library. It is also assumes a modest familiarity with the Java SDK and Java command-line interface including basic familiarity with Maven packages. Additionally, it considers a certain level of knowledge in Java language. +This guide will walk you through the essential steps to quickly get up and running with the new JSON Schema library. It is also assumed a modest familiarity with the Java language, Java SDK, and Java command-line interface, including basic familiarity with Maven packages. ## Maven Library Package To get started, launch your preferred IDE (such as IntelliJ IDEA, NetBeans IDE, Eclipse IDE, or VS Code) and open the Java project where you intend to include this library package. If you are using a build tool like Maven or Gradle, adding the library to your project is straightforward. For example in Maven project, navigate to the Maven `pom.xml` file and locate the section named `` and add the following XML snippet within the section of the file, replacing `1.x.x` with either the latest version or your preferred version: @@ -19,7 +19,7 @@ To get started, launch your preferred IDE (such as IntelliJ IDEA, NetBeans IDE, For additional information regarding this library package, you can visit the Maven repository page of this library [here](https://central.sonatype.com/artifact/com.relogiclabs.json/relogiclabs-json-schema), and files are also available [here](https://repo1.maven.org/maven2/com/relogiclabs/json/relogiclabs-json-schema/). ## Write a Sample to Test -With the necessary components in place, you are now prepared to create a sample schema and validate a corresponding JSON against the schema. The subsequent example presents a Java class featuring a method designed for validating a sample JSON based on a provided schema. +With all the necessary components in place, you are now ready to create a sample schema and validate a corresponding JSON against the schema. The subsequent example presents a Java class featuring a method designed for validating a sample JSON based on a provided schema. If you are working with Java 17 or above, you can enhance the code further by utilizing new language features. ```java import com.relogiclabs.json.schema.JsonSchema; @@ -38,9 +38,11 @@ public class SampleSchema { /*currently only one role is allowed by system*/ "role": "user" #string, "isActive": #boolean, //user account current status + "registeredAt": #time, "profile": { "firstName": @regex("[A-Za-z ]{3,50}") #string, "lastName": @regex("[A-Za-z ]{3,50}") #string, + "dateOfBirth": #date, "age": @range(18, 130) #integer, "email": @email #string, "pictureURL": @url #string, @@ -57,13 +59,15 @@ public class SampleSchema { """ { "user": { - "id": 1234, + "id": 1111, "username": "johndoe", "role": "user", "isActive": true, + "registeredAt": "2023-09-06T15:10:30.639Z", "profile": { "firstName": "John", "lastName": "Doe", + "dateOfBirth": "1993-06-17", "age": 30, "email": "john.doe@example.com", "pictureURL": "https://example.com/picture.jpg", @@ -107,7 +111,6 @@ Let's intentionally introduce a few errors by modifying the previous JSON docume } ``` To achieve the desired outcome, please make the following changes to the preceding code. Specifically, ensure that any schema validation errors are displayed in the console. The modified code snippet that invokes the `writeError` method to display the errors if validation fails is as follows: - ```java ... @@ -117,13 +120,12 @@ if(!jsonSchema.isValid(json)) jsonSchema.writeError(); ... ``` Here is the error as displayed in the console. More specific errors will be listed first, followed by more general errors. Consequently, the specific errors will precisely pinpoint the issues within the JSON document, while the generic errors will provide contextual information about where the errors occurred. - ```json Schema (Line: 6:31) Json (Line: 3:14) [DTYP04]: Data type mismatch. Data type #integer is expected but found #string inferred by "not number". -Schema (Line: 6:14) [FUNC03]: Function @range(1, 10000) is applicable on #number but applied on #string of "not number" +Schema (Line: 6:14) Json (Line: 3:14) [FUNC03]: Function @range(1, 10000) is incompatible with the target data type. Applying to a supported data type such as #number is expected but applied to an unsupported data type #string of "not number". Schema (Line: 8:20) Json (Line: 4:20) [REGX01]: Regex pattern does not match. String of pattern "[a-z_]{3,30}" is expected but found "john doe" that mismatches with pattern. -Schema (Line: 5:12) Json (Line: 2:12) [VALD01]: Validation Failed. Value {"id": @range(1, 10000) #integer, "username": @regex("[a-z_]{3,30}") #string, "role": "user" #string, "isActive": #boolean, "profile"...ing, "country": @regex("[A-Za-z ]{3,50}") #string} #object #null}} is expected but found {"id": "not number", "username": "john doe", "role": "user", "isActive": true, "profile": {"firstName": "John", "lastName": "Doe", "a...: "123 Some St", "city": "Some town", "country": "Some Country"}}}. -Schema (Line: 4:0) Json (Line: 1:0) [VALD01]: Validation Failed. Value {"user": {"id": @range(1, 10000) #integer, "username": @regex("[a-z_]{3,30}") #string, "role": "user" #string, "isActive": #boolean, ...ng, "country": @regex("[A-Za-z ]{3,50}") #string} #object #null}}} is expected but found {"user": {"id": "not number", "username": "john doe", "role": "user", "isActive": true, "profile": {"firstName": "John", "lastName": ... "123 Some St", "city": "Some town", "country": "Some Country"}}}}. +Schema (Line: 5:12) Json (Line: 2:12) [VALD01]: Validation failed. Value {"id": @range(1, 10000) #integer, "username": @regex("[a-z_]{3,30}") #string, "role": "user" #string, "isActive": #boolean, "register...ing, "country": @regex("[A-Za-z ]{3,50}") #string} #object #null}} is expected but found {"id": "not number", "username": "john doe", "role": "user", "isActive": true, "registeredAt": "2023-09-06T15:10:30.639Z", "profile":...: "123 Some St", "city": "Some town", "country": "Some Country"}}}. +Schema (Line: 4:0) Json (Line: 1:0) [VALD01]: Validation failed. Value {"user": {"id": @range(1, 10000) #integer, "username": @regex("[a-z_]{3,30}") #string, "role": "user" #string, "isActive": #boolean, ...ng, "country": @regex("[A-Za-z ]{3,50}") #string} #object #null}}} is expected but found {"user": {"id": "not number", "username": "john doe", "role": "user", "isActive": true, "registeredAt": "2023-09-06T15:10:30.639Z", "... "123 Some St", "city": "Some town", "country": "Some Country"}}}}. ``` ## Assertion for Validation @@ -145,17 +147,17 @@ com.relogiclabs.json.schema.exception.JsonSchemaException: DTYP04: Data type mis Expected (Schema Line: 6:31): data type #integer Actual (Json Line: 3:14): found #string inferred by "not number" - at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:85) - at com.relogiclabs.json.schema.types.JValidator.lambda$match$0(JValidator.java:82) - at java.base/java.lang.Iterable.forEach(Iterable.java:75) - at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:82) - at com.relogiclabs.json.schema.types.JObject.match(JObject.java:63) - at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:76) - at com.relogiclabs.json.schema.types.JObject.match(JObject.java:63) - at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:76) - at com.relogiclabs.json.schema.types.JRoot.match(JRoot.java:73) + at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:86) + at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:68) + at com.relogiclabs.json.schema.types.JValidator.matchDataType(JValidator.java:67) + at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:57) + at com.relogiclabs.json.schema.types.JObject.match(JObject.java:55) + at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:52) + at com.relogiclabs.json.schema.types.JObject.match(JObject.java:55) + at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:52) + at com.relogiclabs.json.schema.types.JRoot.match(JRoot.java:47) at com.relogiclabs.json.schema.JsonAssert.isValid(JsonAssert.java:54) - at org.example.SampleSchema.checkIsValid(SampleSchema.java:61) + at org.example.SampleSchema.checkIsValid(SampleSchema.java:64) at org.example.Main.main(Main.java:5) ``` -For more information about the schema syntax format and library functionalities, please refer to the reference documentation [here](/JsonSchema-Java/api/index.html). \ No newline at end of file +For more information about the schema syntax format and library functionalities, please refer to the reference documentation [here](/JsonSchema-Java/api/index.html). diff --git a/doc/content/articles/sourcebuild.md b/doc/content/articles/sourcebuild.md index b2b0749..061a927 100644 --- a/doc/content/articles/sourcebuild.md +++ b/doc/content/articles/sourcebuild.md @@ -1,11 +1,11 @@ +++ title = 'Source Build' -date = 2023-10-10T09:38:53+06:00 +date = 2023-11-03T09:38:53+06:00 weight = 9 +++ # Build from Source Code -This comprehensive guide illustrates the procedures for retrieving source code from a GitHub repository, compiling the project source code into a library, and seamlessly integrating the compiled library into your project. It is important to have a foundational understanding of the Java language, as well as a modest level of familiarity with the Java SDK and command-line interface. You should also have a basic knowledge of how to work with Maven packages. +This comprehensive guide illustrates the procedures for retrieving source code from a GitHub repository, compiling the project source code into a library, and seamlessly integrating the compiled library into your project. It is important to have a foundational understanding of the Java language, as well as a modest level of familiarity with the Java SDK and command-line interface. You also need a basic knowledge of how to work with Maven packages. ## Build the Library To get started, clone the project from the following URL using your preferred Git client (command line or GUI). You can open a terminal and enter the following Git clone command as shown below: @@ -30,7 +30,7 @@ To integrate the library into your project, open it in your preferred IDE (such ``` ## Write a Sample to Test -With the necessary components in place, you are now prepared to create a sample schema and validate a corresponding JSON against the schema. The subsequent example presents a Java class featuring a method designed for validating a sample JSON based on a provided schema. +With all the necessary components in place, you are now ready to create a sample schema and validate a corresponding JSON against the schema. The subsequent example presents a Java class featuring a method designed for validating a sample JSON based on a provided schema. If you are working with Java 17 or above, you can enhance the code further by utilizing new language features. ```java import com.relogiclabs.json.schema.JsonSchema; @@ -49,9 +49,11 @@ public class SampleSchema { /*currently only one role is allowed by system*/ "role": "user" #string, "isActive": #boolean, //user account current status + "registeredAt": #time, "profile": { "firstName": @regex("[A-Za-z ]{3,50}") #string, "lastName": @regex("[A-Za-z ]{3,50}") #string, + "dateOfBirth": #date, "age": @range(18, 130) #integer, "email": @email #string, "pictureURL": @url #string, @@ -68,13 +70,15 @@ public class SampleSchema { """ { "user": { - "id": 1234, + "id": 1111, "username": "johndoe", "role": "user", "isActive": true, + "registeredAt": "2023-09-06T15:10:30.639Z", "profile": { "firstName": "John", "lastName": "Doe", + "dateOfBirth": "1993-06-17", "age": 30, "email": "john.doe@example.com", "pictureURL": "https://example.com/picture.jpg", @@ -129,14 +133,14 @@ if(!jsonSchema.isValid(json)) jsonSchema.writeError(); Here is the error as displayed in the console. More specific errors will be listed first, followed by more general errors. Consequently, the specific errors will precisely pinpoint the issues within the JSON document, while the generic errors will provide contextual information about where the errors occurred. ```json Schema (Line: 6:31) Json (Line: 3:14) [DTYP04]: Data type mismatch. Data type #integer is expected but found #string inferred by "not number". -Schema (Line: 6:14) [FUNC03]: Function @range(1, 10000) is applicable on #number but applied on #string of "not number" +Schema (Line: 6:14) Json (Line: 3:14) [FUNC03]: Function @range(1, 10000) is incompatible with the target data type. Applying to a supported data type such as #number is expected but applied to an unsupported data type #string of "not number". Schema (Line: 8:20) Json (Line: 4:20) [REGX01]: Regex pattern does not match. String of pattern "[a-z_]{3,30}" is expected but found "john doe" that mismatches with pattern. -Schema (Line: 5:12) Json (Line: 2:12) [VALD01]: Validation Failed. Value {"id": @range(1, 10000) #integer, "username": @regex("[a-z_]{3,30}") #string, "role": "user" #string, "isActive": #boolean, "profile"...ing, "country": @regex("[A-Za-z ]{3,50}") #string} #object #null}} is expected but found {"id": "not number", "username": "john doe", "role": "user", "isActive": true, "profile": {"firstName": "John", "lastName": "Doe", "a...: "123 Some St", "city": "Some town", "country": "Some Country"}}}. -Schema (Line: 4:0) Json (Line: 1:0) [VALD01]: Validation Failed. Value {"user": {"id": @range(1, 10000) #integer, "username": @regex("[a-z_]{3,30}") #string, "role": "user" #string, "isActive": #boolean, ...ng, "country": @regex("[A-Za-z ]{3,50}") #string} #object #null}}} is expected but found {"user": {"id": "not number", "username": "john doe", "role": "user", "isActive": true, "profile": {"firstName": "John", "lastName": ... "123 Some St", "city": "Some town", "country": "Some Country"}}}}. +Schema (Line: 5:12) Json (Line: 2:12) [VALD01]: Validation failed. Value {"id": @range(1, 10000) #integer, "username": @regex("[a-z_]{3,30}") #string, "role": "user" #string, "isActive": #boolean, "register...ing, "country": @regex("[A-Za-z ]{3,50}") #string} #object #null}} is expected but found {"id": "not number", "username": "john doe", "role": "user", "isActive": true, "registeredAt": "2023-09-06T15:10:30.639Z", "profile":...: "123 Some St", "city": "Some town", "country": "Some Country"}}}. +Schema (Line: 4:0) Json (Line: 1:0) [VALD01]: Validation failed. Value {"user": {"id": @range(1, 10000) #integer, "username": @regex("[a-z_]{3,30}") #string, "role": "user" #string, "isActive": #boolean, ...ng, "country": @regex("[A-Za-z ]{3,50}") #string} #object #null}}} is expected but found {"user": {"id": "not number", "username": "john doe", "role": "user", "isActive": true, "registeredAt": "2023-09-06T15:10:30.639Z", "... "123 Some St", "city": "Some town", "country": "Some Country"}}}}. ``` ## Assertion for Validation -To utilize this library for test automation and API testing, you can employ the following alternative code snippet to perform assertions on input JSON against a specified schema. For instance, let's examine how to assert the JSON, which has been intentionally altered to introduce some errors, against the aforementioned schema. The following demonstrates the adjusted code for asserting the JSON with errors: +To utilize this library for test automation and API testing, you can use the following alternative code snippet to perform assertions on input JSON against a specified schema. For instance, let's examine how to assert the JSON, which has been intentionally altered to introduce some errors, against the aforementioned schema. The following demonstrates the adjusted code for asserting the JSON with errors: ```java ... @@ -154,17 +158,17 @@ com.relogiclabs.json.schema.exception.JsonSchemaException: DTYP04: Data type mis Expected (Schema Line: 6:31): data type #integer Actual (Json Line: 3:14): found #string inferred by "not number" - at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:85) - at com.relogiclabs.json.schema.types.JValidator.lambda$match$0(JValidator.java:82) - at java.base/java.lang.Iterable.forEach(Iterable.java:75) - at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:82) - at com.relogiclabs.json.schema.types.JObject.match(JObject.java:63) - at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:76) - at com.relogiclabs.json.schema.types.JObject.match(JObject.java:63) - at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:76) - at com.relogiclabs.json.schema.types.JRoot.match(JRoot.java:73) + at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:86) + at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:68) + at com.relogiclabs.json.schema.types.JValidator.matchDataType(JValidator.java:67) + at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:57) + at com.relogiclabs.json.schema.types.JObject.match(JObject.java:55) + at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:52) + at com.relogiclabs.json.schema.types.JObject.match(JObject.java:55) + at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:52) + at com.relogiclabs.json.schema.types.JRoot.match(JRoot.java:47) at com.relogiclabs.json.schema.JsonAssert.isValid(JsonAssert.java:54) - at org.example.SampleSchema.checkIsValid(SampleSchema.java:61) + at org.example.SampleSchema.checkIsValid(SampleSchema.java:64) at org.example.Main.main(Main.java:5) ``` -For more information about the schema syntax format and library functionalities, please refer to the reference documentation [here](/JsonSchema-Java/api/index.html). \ No newline at end of file +For more information about the schema syntax format and library functionalities, please refer to the reference documentation [here](/JsonSchema-Java/api/index.html). diff --git a/doc/layouts/partials/head.html b/doc/layouts/partials/head.html index 5a005b6..64a734a 100644 --- a/doc/layouts/partials/head.html +++ b/doc/layouts/partials/head.html @@ -1,3 +1,5 @@ + + \ No newline at end of file diff --git a/doc/layouts/partials/header.html b/doc/layouts/partials/header.html index 05dcdce..e8fbf6a 100644 --- a/doc/layouts/partials/header.html +++ b/doc/layouts/partials/header.html @@ -1,7 +1,15 @@