Skip to content

Commit 5d49342

Browse files
Merge pull request #6 from relogiclabs/develop
Refactor and Optimize Code
2 parents b13ff06 + 548ec64 commit 5d49342

File tree

408 files changed

+9234
-12466
lines changed

Some content is hidden

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

408 files changed

+9234
-12466
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The next example represents an expanded version of the previous one, which bring
6767
```cpp
6868
%title: "Extended User Profile Dashboard API Response"
6969
%version: 2.0.0
70-
%include: com.relogiclabs.json.schema.positive.ExternalFunctions
70+
%include: com.relogiclabs.json.schema.external.ExternalFunctions
7171

7272
%pragma DateDataTypeFormat: "DD-MM-YYYY"
7373
%pragma TimeDataTypeFormat: "DD-MM-YYYY hh:mm:ss"

doc/content/articles/directives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ In a schema, the version directive is used to provide a version number of the sc
2828
## Include Directive
2929
Include directive enables the addition or inclusion of a class, as defined by object-oriented programming, to a schema along with a set of methods that have specific signatures for performing custom validations. This feature extends the built-in validation capabilities of the schema. The example below illustrates how to utilize the include directive in Java language:
3030
```js
31-
%include: com.relogiclabs.json.schema.positive.ExternalFunctions
31+
%include: com.relogiclabs.json.schema.external.ExternalFunctions
3232
```
3333

3434
## Pragma Directive

doc/content/articles/functions.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ If either the parameter values for `minimum` or `maximum` are unspecified or und
102102
```
103103
Validates that the `target` number is greater than or equal to the `minimum` number specified as a parameter, unless the `exclusive` parameter flag is explicitly set to `true`, in which case the `target` number must be exclusively greater than the `minimum` number.
104104

105-
| Ues Cases | Valid Values | Invalid Values |
106-
|--------------------|--------------------------|--------------------------|
107-
| `minimum(0)` | `0`; `1`; `1000` | `-1`; `-10`; `-10000` |
108-
| `minimum(10.5)` | `10.5`; `10.6`; `1000.1` | `10.49`; `1.0`; `-100.1` |
109-
| `minimum(0, true)` | `0.001`; `1.01`; `100.1` | `0`; `-0.01`; `-100.1` |
105+
| Ues Cases | Valid Values | Invalid Values |
106+
|---------------------|--------------------------|--------------------------|
107+
| `@minimum(0)` | `0`; `1`; `1000` | `-1`; `-10`; `-10000` |
108+
| `@minimum(10.5)` | `10.5`; `10.6`; `1000.1` | `10.49`; `1.0`; `-100.1` |
109+
| `@minimum(0, true)` | `0.001`; `1.01`; `100.1` | `0`; `-0.01`; `-100.1` |
110110

111111
### Number Maximum
112112
```stylus
@@ -115,11 +115,11 @@ Validates that the `target` number is greater than or equal to the `minimum` num
115115
```
116116
Validates that the `target` number is less than or equal to the `maximum` number specified as a parameter, unless the `exclusive` parameter flag is explicitly set to `true`, in which case the `target` number must be exclusively less than the `maximum` number.
117117

118-
| Ues Cases | Valid Values | Invalid Values |
119-
|--------------------|------------------------------|---------------------------|
120-
| `maximum(100)` | `100`; `-100`; `0` | `101`; `1000`; `10000` |
121-
| `maximum(10.5)` | `10.50`; `10.49`; `-1000.1` | `10.51`; `11.0`; `1000.1` |
122-
| `maximum(0, true)` | `-0.001`; `-1.01`; `-1000.1` | `0`; `0.01`; `100.1` |
118+
| Ues Cases | Valid Values | Invalid Values |
119+
|---------------------|------------------------------|---------------------------|
120+
| `@maximum(100)` | `100`; `-100`; `0` | `101`; `1000`; `10000` |
121+
| `@maximum(10.5)` | `10.50`; `10.49`; `-1000.1` | `10.51`; `11.0`; `1000.1` |
122+
| `@maximum(0, true)` | `-0.001`; `-1.01`; `-1000.1` | `0`; `0.01`; `100.1` |
123123

124124
### String Enum
125125
```stylus
@@ -230,17 +230,29 @@ Validates that the `target` date-time is exclusively before the `reference` date
230230
```
231231
Validates that the `target` date-time is exclusively after the `reference` date-time. If the `target` date-time finds on or before the `reference` date-time, a validation error is triggered. The `reference` parameter must be the string representation of the `target` data type, which can either be a `#date` or `#time` type.
232232

233-
### Number Positive
233+
### Number Positive and Negative
234234
```stylus
235235
#number target - @positive
236+
#number target - @positive(#number reference)
236237
```
237-
Validates that the `target` number is positive. If the `target` number is zero or negative, it generates a validation error.
238+
Validates that the `target` number is positive or positive from (or relative to) the specified `reference`. If the `target` number is zero or negative for the first definition or less than the `reference` for the second definition, it generates a validation error.
238239

239-
### Number Negative
240240
```stylus
241241
#number target - @negative
242-
```
243-
Validates that the `target` number is negative. If the `target` number is zero or positive, it generates a validation error.
242+
#number target - @negative(#number reference)
243+
```
244+
Validates that the `target` number is negative or negative from (or relative to) the specified `reference`. If the `target` number is zero or positive for the first definition or greater than the `reference` for the second definition, it generates a validation error.
245+
246+
| Ues Cases | Valid Values | Invalid Values |
247+
|------------------|--------------------------|------------------------|
248+
| `@positive` | `1`; `5`; `1000` | `0`; `-1`; `-1000` |
249+
| `@negative` | `-1`; `-5`; `-1000` | `0`; `1`; `1000` |
250+
| `@positive(0)` | `0`; `1`; `5`; `1000` | `-1`; `-5`; `-1000` |
251+
| `@positive(10)` | `10`; `100`; `10000` | `1`; `5`; `-1000` |
252+
| `@negative(0)` | `0`; `-1`; `-5`; `-1000` | `1`; `5`; `1000` |
253+
| `@negative(-10)` | `-10`; `-100`; `-10000` | `0`; `-5`; `1000` |
254+
| `@positive(-1)` | `-1`; `0`; `10000` | `-10`; `-100`; `-1000` |
255+
| `@negative(1)` | `1`; `0`; `-10000` | `10`; `100`; `1000` |
244256

245257
### String Not Empty
246258
```stylus

doc/content/articles/quickstart.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,19 @@ com.relogiclabs.json.schema.exception.JsonSchemaException: DTYP04: Data type mis
147147
Expected (Schema Line: 6:31): data type #integer
148148
Actual (Json Line: 3:14): found #string inferred by "not number"
149149

150-
at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:86)
151-
at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:68)
152-
at com.relogiclabs.json.schema.types.JValidator.matchDataType(JValidator.java:67)
153-
at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:57)
154-
at com.relogiclabs.json.schema.types.JObject.match(JObject.java:55)
155-
at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:52)
156-
at com.relogiclabs.json.schema.types.JObject.match(JObject.java:55)
157-
at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:52)
158-
at com.relogiclabs.json.schema.types.JRoot.match(JRoot.java:47)
159-
at com.relogiclabs.json.schema.JsonAssert.isValid(JsonAssert.java:54)
150+
at com.relogiclabs.json.schema.type.JDataType.matchForReport(JDataType.java:90)
151+
at com.relogiclabs.json.schema.type.JDataType.matchForReport(JDataType.java:72)
152+
at com.relogiclabs.json.schema.type.JValidator.lambda$matchDataType$4(JValidator.java:74)
153+
at com.relogiclabs.json.schema.type.JValidator.matchDataType(JValidator.java:74)
154+
at com.relogiclabs.json.schema.type.JValidator.match(JValidator.java:64)
155+
at com.relogiclabs.json.schema.type.JObject.match(JObject.java:57)
156+
at com.relogiclabs.json.schema.type.JValidator.match(JValidator.java:59)
157+
at com.relogiclabs.json.schema.type.JObject.match(JObject.java:57)
158+
at com.relogiclabs.json.schema.type.JValidator.match(JValidator.java:59)
159+
at com.relogiclabs.json.schema.type.JRoot.match(JRoot.java:50)
160+
at com.relogiclabs.json.schema.tree.SchemaTree.match(SchemaTree.java:33)
161+
at com.relogiclabs.json.schema.JsonAssert.isValid(JsonAssert.java:61)
162+
at com.relogiclabs.json.schema.JsonAssert.isValid(JsonAssert.java:72)
160163
at org.example.SampleSchema.checkIsValid(SampleSchema.java:64)
161164
at org.example.Main.main(Main.java:5)
162165
```

doc/content/articles/sourcebuild.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,20 @@ com.relogiclabs.json.schema.exception.JsonSchemaException: DTYP04: Data type mis
158158
Expected (Schema Line: 6:31): data type #integer
159159
Actual (Json Line: 3:14): found #string inferred by "not number"
160160

161-
at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:86)
162-
at com.relogiclabs.json.schema.types.JDataType.matchForReport(JDataType.java:68)
163-
at com.relogiclabs.json.schema.types.JValidator.matchDataType(JValidator.java:67)
164-
at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:57)
165-
at com.relogiclabs.json.schema.types.JObject.match(JObject.java:55)
166-
at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:52)
167-
at com.relogiclabs.json.schema.types.JObject.match(JObject.java:55)
168-
at com.relogiclabs.json.schema.types.JValidator.match(JValidator.java:52)
169-
at com.relogiclabs.json.schema.types.JRoot.match(JRoot.java:47)
170-
at com.relogiclabs.json.schema.JsonAssert.isValid(JsonAssert.java:54)
161+
at com.relogiclabs.json.schema.type.JDataType.matchForReport(JDataType.java:90)
162+
at com.relogiclabs.json.schema.type.JDataType.matchForReport(JDataType.java:72)
163+
at com.relogiclabs.json.schema.type.JValidator.lambda$matchDataType$4(JValidator.java:74)
164+
at com.relogiclabs.json.schema.type.JValidator.matchDataType(JValidator.java:74)
165+
at com.relogiclabs.json.schema.type.JValidator.match(JValidator.java:64)
166+
at com.relogiclabs.json.schema.type.JObject.match(JObject.java:57)
167+
at com.relogiclabs.json.schema.type.JValidator.match(JValidator.java:59)
168+
at com.relogiclabs.json.schema.type.JObject.match(JObject.java:57)
169+
at com.relogiclabs.json.schema.type.JValidator.match(JValidator.java:59)
170+
at com.relogiclabs.json.schema.type.JRoot.match(JRoot.java:50)
171+
at com.relogiclabs.json.schema.tree.SchemaTree.match(SchemaTree.java:33)
172+
at com.relogiclabs.json.schema.JsonAssert.isValid(JsonAssert.java:61)
173+
at com.relogiclabs.json.schema.JsonAssert.isValid(JsonAssert.java:72)
171174
at org.example.SampleSchema.checkIsValid(SampleSchema.java:64)
172175
at org.example.Main.main(Main.java:5)
173176
```
174-
For more information about the schema syntax format and library functionalities, please refer to the reference documentation [here](/JsonSchema-Java/api/index.html).
177+
For more information about the schema syntax format and library functionalities, please refer to the reference documentation [here](/JsonSchema-Java/api/index.html).

0 commit comments

Comments
 (0)