Skip to content

Commit

Permalink
Merge pull request #9 from relogiclabs/develop
Browse files Browse the repository at this point in the history
Update Project Documentations
  • Loading branch information
zhossain-info committed Feb 5, 2024
2 parents e0edfbc + 9b38ecd commit 4f3d1bd
Show file tree
Hide file tree
Showing 26 changed files with 138 additions and 99 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# A New JSON Schema
A JSON Schema is crucial for making communication, interoperability, validation, testing, documentation, and specification seamless. All of this combined contributes to better maintenance and evolution of data-driven applications and systems. For a comprehensive overview of the roles and uses of JSON Schema in modern web applications, we invite you to explore our dedicated post available [here](https://www.relogiclabs.com/2023/01/the-roles-of-json-schema.html).
A JSON Schema is crucial for making communication, interoperability, validation, testing, documentation, and specification seamless. All of this combined contributes to better maintenance and evolution of data-driven applications and systems. If you are interested in an overview of the roles and usage of JSON Schema in modern web applications, check out our in-depth post [here](https://www.relogiclabs.com/2023/01/the-roles-of-json-schema.html).

## Design Goals
The traditional standard JSON Schema rigorously follows the conventional JSON structure, which unfortunately comes at the expense of simplicity, conciseness, and readability. Our goal is to develop a new JSON Schema that promotes these essential aspects that were previously missing.
Expand Down Expand Up @@ -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 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/JSchema-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/JSchema-Java/articles/introduction).
```json
{
"user": {
Expand All @@ -63,7 +63,7 @@ In the above example, two types of constraints are used: constraint functions (a
}
```
## Extended Example
The next example represents an expanded version of the previous one, which brings more complexity. To effectively construct such schemas with multiple layers of nested structures, it's beneficial to have a fundamental understanding of this schema format. While the syntax may seem difficult at first, it becomes straightforward once you have a basic understanding of it. For more detailed information, reference documentation is available [here](https://relogiclabs.github.io/JSchema-Java/articles/intro).
The next example represents an expanded version of the previous one, which brings more complexity. To effectively construct such schemas with multiple layers of nested structures, it's beneficial to have a fundamental understanding of this schema format. While the syntax may seem difficult at first, it becomes straightforward once you have a basic understanding of it. For more detailed information, reference documentation is available [here](https://relogiclabs.github.io/JSchema-Java/articles/introduction).
```cpp
%title: "Extended User Profile Dashboard API Response"
%version: 2.0.0
Expand Down Expand Up @@ -171,7 +171,7 @@ The subsequent JSON sample is an illustrative example that successfully validate
{
"id": 2,
"title": "Working with JSON in Java",
"content": "Java provides built-in support for working with JSON...",
"content": "Java provides great support for working with JSON...",
"tags": [
"CSharp",
"JSON",
Expand Down
24 changes: 18 additions & 6 deletions doc/content/_index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
+++
title = 'New Json Schema'
title = 'Introduction'
date = 2023-10-08T09:38:53+06:00
+++

# New Json Schema
The New JSON Schema prioritizes simplicity, conciseness, and readability, making it user-friendly and accessible without the need for extensive prior knowledge. It offers efficient read-write facilities, precise JSON document definition through various data types and functions, and extensibility to meet modern web service diverse requirements. For a comprehensive overview of this JSON Schema, we invite you to explore our dedicated post available [here](https://www.relogiclabs.com/p/json-schema.html).
# Introduction
The New JSON Schema prioritizes simplicity, conciseness, and readability, making it intuitive and accessible without the need for extensive prior knowledge. It offers efficient read-write facilities, precise JSON document definition through various data types and functions, and extensibility to meet modern web service diverse requirements.

<div class="banner-image">
<img src="/JSchema-Java/images/json-schema.webp" alt="New Json Schema">
</div>
JSON, short for JavaScript Object Notation, is one of the most widely used data exchange formats that are both user-friendly and machine-readable. New JSON Schema is a practical tool for defining and validating the structure of JSON documents. The following guides offer comprehensive details about the New JSON Schema. This document provides a list of links, each corresponding to a specific detail document available in this project.
<br/>

* <font size="4">[Getting Started & Installation](/JSchema-Java/articles/quickstart)</font>
* <font size="4">[Validation Syntax & Format](/JSchema-Java/articles/validation)</font>
* <font size="4">[Validation Directives & Pragmas](/JSchema-Java/articles/directives)</font>
* <font size="4">[Schema Specification & Grammar](/JSchema-Java/articles/specification)</font>
* <font size="4">[Data Types & Validation](/JSchema-Java/articles/datatypes)</font>
* <font size="4">[Functions & Validation](/JSchema-Java/articles/functions)</font>
* <font size="4">[Date & Time Patterns](/JSchema-Java/articles/datetime)</font>
* <font size="4">[Defining Schema Components](/JSchema-Java/articles/components)</font>
* <font size="4">[Build from Source Code](/JSchema-Java/articles/sourcebuild)</font>
* <font size="4">[API Reference Documentation](/JSchema-Java/api/index.html)</font>
* <font size="4">[GitHub Source Code Repository](https://github.com/relogiclabs/JSchema-Java)</font>
<br/>
12 changes: 8 additions & 4 deletions doc/content/articles/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ date = 2023-12-15T09:38:53+06:00
weight = 9
+++

# Reusable Components
A schema component, also known as a reusable schema fragment or sub-schema, plays a vital role in improving readability, reducing redundancy, and organizing the structure of a Schema document. In JSON validation, a schema component or fragment defines a validation rule that can be recursively composed of multiple nested validation rules, collectively specifying the expected and valid format of a JSON structure.
# Schema Components
A schema component, also known as a reusable schema fragment or sub-schema, plays a vital role in improving readability, reducing redundancy, and organizing the structure of a Schema document. In JSON validation, a schema component or fragment defines a validation rule that can be recursively composed of multiple nested validation rules, collectively specifying the expected and valid format of a JSON construct.

These schema components are utilized as extensions of data type validation, as basic data types have a very limited ability to validate the internal structure of a composite JSON value or construct. Therefore, a data type is parameterized with a component to validate the internal structure of such composite JSON constructs. Moreover, schema components can be referenced from any other part of the Schema document, effectively reducing redundancy and enhancing reusability. The following example defines a simple schema component named `$component` where the validation rule describes an object structure with two key-value pairs:
These schema components are used as an extension of data type validation, as core data types have limited features to validate the internal structure of a composite JSON value or construct. Therefore, a data type is parameterized with a schema component to validate the internal structure of such composite JSON constructs.

The name or alias of a schema component always starts with `$` which also refers to the fact that they are named schema components or fragments defined elsewhere in the schema. Schema components can be referenced from any other part of the schema document, effectively reducing redundancy and enhancing reusability and readability. The following example defines a simple schema component named `$component` where the validation rule describes an object structure with two key-value pairs:
```js
%define $component: { "key1": #integer, "key2": #string }
```
Expand All @@ -34,7 +36,9 @@ In the above table, all three rows have identical validation constraints for the
%schema: @length(1, 10) #object*($article) #array
```

In practical scenarios, JSON arrays often hold multiple composite JSON constructs as elements, typically sharing a recurring pattern and structure similar to the example above. To facilitate the validation of such elements, using schema components is highly effective. By defining a reusable schema component, one can improve readability, conciseness, and organization of the Schema document with such recurring structures. For instance, consider the following example of a JSON document which is valid against the Schema example above:
In practical scenarios, JSON arrays often hold multiple composite JSON constructs as elements, typically sharing a recurring pattern and structure similar to the example above. To facilitate the validation of such elements, using schema components is highly effective.

By defining a reusable schema component with a clear and descriptive name, one can improve the overall clarity and readability of the Schema document with recurring structures. This clarity not only makes it easier to understand the structure and intent of the schema but also contributes to keeping your complex schema well-organized, concise, and more manageable. For instance, consider the following example of a JSON document which is valid against the schema example provided above, demonstrating the usage of a schema component:
```js
[
{
Expand Down
6 changes: 1 addition & 5 deletions doc/content/articles/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ The `IgnoreObjectPropertyOrder` pragma directive provides a means to enforce a s
```

## Definition / Define Directive
This feature in JSON schemas allows you to define a name for a component or fragment of schema or validation rules, which can be referenced from various parts of your schema. This means that if you encounter similar validation requirements in different sections of your schema, you can conveniently refer to the named component instead of duplicating the same validation rules.

By providing clear and descriptive names for these validation rules or sub-schemas, you can enhance the overall clarity and context of your schema. This clarity not only makes it easier to understand the structure and intent of the schema but also contributes to keeping your complex schema well-organized, concise, and more manageable. For more information about the schema component syntax and format, please refer to the documentation [here](/JSchema-Java/articles/components).

The name or alias of the directive is always start with `$` which also refers to that they are named fragment defined elsewhere in the schema. Here is a simple example of how to use this directive:
This feature in JSON schemas allows you to define a name for a schema component or fragment, which can be referenced from various parts of your schema. This means that if you encounter similar validation requirements in different sections of your schema, you can conveniently refer to the named schema component instead of duplicating the same validation rules. For more information about the schema component syntax and format, please refer to the documentation [here](/JSchema-Java/articles/components). Here is a simple example of how to use this directive:
```js
%define $product: {
"id": @length(2, 10) @regex("[a-z][a-z0-9]+") #string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ weight = 1
+++

# Introduction
JSON, short for JavaScript Object Notation, is one of the most widely used data exchange formats that are both user-friendly and machine-readable. New JSON Schema is a practical tool for defining and validating the structure of JSON documents. It allows you to specify the expected format, data types, and constraints of JSON data. The following guides offer comprehensive details about the New JSON Schema. This document provides a list of links, each corresponding to a specific detail document available in this project.
The New JSON Schema prioritizes simplicity, conciseness, and readability, making it intuitive and accessible without the need for extensive prior knowledge. It offers efficient read-write facilities, precise JSON document definition through various data types and functions, and extensibility to meet modern web service diverse requirements.

JSON, short for JavaScript Object Notation, is one of the most widely used data exchange formats that are both user-friendly and machine-readable. New JSON Schema is a practical tool for defining and validating the structure of JSON documents. The following guides offer comprehensive details about the New JSON Schema. This document provides a list of links, each corresponding to a specific detail document available in this project.
<br/>

* <font size="4">[Getting Started & Installation](/JSchema-Java/articles/quickstart)</font>
Expand All @@ -15,8 +17,8 @@ JSON, short for JavaScript Object Notation, is one of the most widely used data
* <font size="4">[Data Types & Validation](/JSchema-Java/articles/datatypes)</font>
* <font size="4">[Functions & Validation](/JSchema-Java/articles/functions)</font>
* <font size="4">[Date & Time Patterns](/JSchema-Java/articles/datetime)</font>
* <font size="4">[Reusable Components of Validation](/JSchema-Java/articles/components)</font>
* <font size="4">[Defining Schema Components](/JSchema-Java/articles/components)</font>
* <font size="4">[Build from Source Code](/JSchema-Java/articles/sourcebuild)</font>
* <font size="4">[API Reference Documentation](/JSchema-Java/api/index.html)</font>

<br/>
* <font size="4">[GitHub Source Code Repository](https://github.com/relogiclabs/JSchema-Java)</font>
<br/>
2 changes: 1 addition & 1 deletion doc/content/articles/sourcebuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ weight = 10
+++

# 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 also need 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 essential 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. Some basic knowledge of how to work with Maven packages would be helpful.

## 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:
Expand Down
Loading

0 comments on commit 4f3d1bd

Please sign in to comment.