Skip to content

Commit 5505d4f

Browse files
Merge pull request #4 from relogiclabs/develop
Refactor and Optimize Code
2 parents 3a046b8 + bf32061 commit 5505d4f

File tree

325 files changed

+2887
-3430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+2887
-3430
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Let's explore an example of our schema for a typical JSON API response containin
3737
}
3838
}
3939
```
40-
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).
40+
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).
4141
```json
4242
{
4343
"user": {
@@ -130,7 +130,7 @@ The next example represents an expanded version of the previous one, which bring
130130
}
131131
}
132132
```
133-
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.
133+
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.
134134
```json
135135
{
136136
"user": {
@@ -219,4 +219,4 @@ The subsequent JSON sample is an illustrative example that successfully validate
219219
}
220220
}
221221
```
222-
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).
222+
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).

doc/content/articles/datetime.md

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,49 @@ Date and time formats are defined using date and time pattern strings. Within th
1111

1212
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.
1313

14-
| Pattern | Description | Example |
15-
|---------|---------------------------------------|---------|
16-
| G | Era period designator | AD |
17-
| YYYY | Four digit year number | 1970 |
18-
| YY | Two digit year number | 70 |
19-
| MM | Month number in year (2 digit form) | 01 |
20-
| MMMM | Full name of month | January |
21-
| MMM | Short name of month | Jan |
22-
| M | Month number in year (1-2 digit form) | 1, 01 |
23-
| DDDD | Full name of day in week | Monday |
24-
| DDD | Short name of day in week | Mon |
25-
| DD | Day in month (2 digit form) | 01 |
26-
| D | Day in month (1-2 digit form) | 1, 01 |
27-
| t | AM/PM designator | AM, PM |
28-
| hh | Hour in day (2 digit form) | 01, 12 |
29-
| h | Hour in day (1-2 digit form) | 1, 01 |
30-
| mm | Minute in hour (2 digit form) | 01, 20 |
31-
| m | Minute in hour (1-2 digit form) | 1, 01 |
32-
| ss | Second in minute (2 digit form) | 1, 01 |
33-
| s | Second in minute (1-2 digit form) | 1, 01 |
34-
| f | Tenths of a second | 1 |
35-
| ff | Hundredths of a second | 11 |
36-
| fff | Milliseconds of a second | 111 |
37-
| ffff | Ten thousandths of a second | 1111 |
38-
| fffff | Hundred thousandths of a second | 11111 |
39-
| ffffff | Millionths of a second | 111111 |
40-
| F | Fraction of a second upto 6 digits | 1, 111 |
14+
| SN | Pattern | Description | Example |
15+
|----|----------|---------------------------------------|-------------------------|
16+
| 1 | `G` | Era period designator | `AD` |
17+
| 2 | `YYYY` | Four digit year number | `1970` |
18+
| 3 | `YY` | Two digit year number | `70` |
19+
| 4 | `MM` | Month number in year (2 digit form) | `01` |
20+
| 5 | `MMMM` | Full name of month | `January` |
21+
| 6 | `MMM` | Short name of month | `Jan` |
22+
| 7 | `M` | Month number in year (1-2 digit form) | `1`; `01` |
23+
| 8 | `DDDD` | Full name of day in week | `Monday` |
24+
| 9 | `DDD` | Short name of day in week | `Mon` |
25+
| 10 | `DD` | Day in month (2 digit form) | `01` |
26+
| 11 | `D` | Day in month (1-2 digit form) | `1`; `01` |
27+
| 12 | `t` | AM/PM designator | `AM`; `PM` |
28+
| 13 | `hh` | Hour in day (2 digit form) | `01`; `12` |
29+
| 14 | `h` | Hour in day (1-2 digit form) | `1`; `01` |
30+
| 15 | `mm` | Minute in hour (2 digit form) | `01`; `20` |
31+
| 16 | `m` | Minute in hour (1-2 digit form) | `1`; `01` |
32+
| 17 | `ss` | Second in minute (2 digit form) | `01`; `30` |
33+
| 18 | `s` | Second in minute (1-2 digit form) | `1`; `01` |
34+
| 19 | `f` | Tenths of a second | `1` |
35+
| 20 | `ff` | Hundredths of a second | `11` |
36+
| 21 | `fff` | Milliseconds of a second | `111` |
37+
| 22 | `ffff` | Ten thousandths of a second | `1111` |
38+
| 23 | `fffff` | Hundred thousandths of a second | `11111` |
39+
| 24 | `ffffff` | Millionths of a second | `111111` |
40+
| 25 | `F` | Fraction of a second upto 6 digits | `1`; `111`; `111111` |
41+
| 26 | `Z` | Time zone hours only offset | `+06`; `-05`; `Z` |
42+
| 27 | `ZZ` | Time zone hours and minutes offset | `+09:30`; `−03:30`; `Z` |
43+
| 28 | `ZZZ` | Time zone hours and minutes offset | `+0930`; `−0330`; `Z` |
4144

4245
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.
4346

44-
| Combined Pattern | Example |
45-
|-----------------------------|-------------------------------|
46-
| YYYY-MM-DD | 2023-09-01 |
47-
| YYYY-MM-DD'T'hh:mm:ss.fffZZ | 2023-09-01T14:35:10.123+06:00 |
48-
| MMMM DD, YYYY G | January 01, 1980 AD |
49-
| DDDD, D MMMM YYYY | Tuesday, 11 July 2023 |
50-
| YYYY.MM.DD hh.mm.ss t | 1980.11.21 10.30.50 pm |
51-
| DDD, D MMM YY hh:mm:ss ZZ | Sun, 4 Jul 99 12:08:56 -06:00 |
52-
| hh:mm:ss t ZZ | 03:11:30 AM +06:00 |
47+
| SN | Usage | Combined Pattern | Example |
48+
|----|---------|-----------------------------|---------------------------------|
49+
| 1 | `#date` | `YYYY-MM-DD` | `2023-09-01` |
50+
| 2 | `#time` | `YYYY-MM-DD'T'hh:mm:ss.FZZ` | `2023-09-01T14:35:10.111+06:00` |
51+
| 3 | `@date` | `MMMM DD, YYYY G` | `January 01, 1980 AD` |
52+
| 4 | `@date` | `DDDD, D MMMM YYYY` | `Tuesday, 11 July 2023` |
53+
| 5 | `@time` | `YYYY.MM.DD hh.mm.ss t` | `1980.11.21 10.30.50 pm` |
54+
| 6 | `@time` | `DDD, D MMM YY hh:mm:ss ZZ` | `Sun, 4 Jul 99 12:08:56 -06:00` |
55+
| 7 | `@time` | `hh:mm:ss t ZZ` | `03:11:30 AM +06:00` |
5356

54-
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.
57+
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).
5558

56-
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.
59+
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.

0 commit comments

Comments
 (0)