eclipse-vertx / eclipse-vertx/vertx-json-schema

Checking support for the key words “oneOf” and “allOf”

Open
#72 15 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
86
Forks
30
PR merge metrics
No merged PRs in 30d

Description

### Questions
I took another look at the capabilities of the following software.

### Version
4.3.4

### Context
I constructed the following JSON schema file.
```json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Calculation information",
"description": "settings for calculations",
"$id": "https://example.com/schemas/calculation_preferences",
"type": "object",
"required": ["context"],
"properties":
{
"context":
{
"type": "object",
"oneOf":
[
{
"allOf":
[
{
"properties":
{
"label": {"const": "GTIN"}
}
},
{
"type": "array",
"minItems": 1,
"items":
{
"type": "string",
"pattern": "^[0-9]{13}$"
}
}
]
},
{
"allOf":
[
{
"properties":
{
"label": {"const": "selection group"}
}
},
{
"type": "array",
"minItems": 1,
"items":
{
"type": "string",
"minLength": 1
}
}
]
}
]
}
}
}
```

Test data example:
```json
{
"context":
{
"GTIN": [ "1234567890123" ]
}
}
```

:thought_balloon: Now I am wondering about the following error information.
```
Markus_Elfring@…:…/Schema-Parsing3> java -jar target/Schema-Parsing3-0.0.1-SNAPSHOT.jar ../Context-test_fragment1.json
Validation errors
error|keyword|keywordLocation|instanceLocation
Property "context" does not match schema|properties|#/properties|#
Instance does not match exactly one subschema (0 matches)|oneOf|#/properties/context/oneOf|#/context
Instance does not match every subschema|allOf|#/properties/context/oneOf/0/allOf|#/context
Instance type object is invalid. Expected array|type|#/properties/context/oneOf/0/allOf/1/type|#/context
Instance does not match every subschema|allOf|#/properties/context/oneOf/1/allOf|#/context
Instance type object is invalid. Expected array|type|#/properties/context/oneOf/1/allOf/1/type|#/context
java.lang.RuntimeException: JSON schema validation failure
at main.java.….app.JsonSchemaCheck.reportErrors(CLI.java:47)
at main.java.….app.JsonSchemaCheck.test4(CLI.java:116)
at main.java.….app.JsonSchemaCheck.call(CLI.java:129)
at main.java.….app.JsonSchemaCheck.call(CLI.java:20)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
at picocli.CommandLine.execute(CommandLine.java:2078)
at main.java.….app.JsonSchemaCheck.main(CLI.java:134)
```

:thinking: I would appreciate further advices and solution ideas for these reported data type mismatches.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.