java-json-tools / json-schema-validator

A JSON Schema validation implementation in pure Java, which aims for correctness and performance, in that order
http://json-schema-validator.herokuapp.com/
Other
1.62k stars 399 forks source link

draftv4/schema is different between json-schema-validator 2.2.14 and json-schema-core 1.2.14 #401

Open nomoa opened 2 years ago

nomoa commented 2 years ago

Hi, we noticed this when bumping to json-schema-validator 2.2.14, we use duplicate-finder-maven-plugin to track jar hell (we build a fat jar) and it appears that the draftv4/schema resource is slightly different in these two projects:

--- json-schema-core-1.2.14-draftv4
+++ json-schema-validator-2.2.14-draftv4
@@ -28,10 +28,12 @@
     "type": "object",
     "properties": {
         "id": {
-            "type": "string"
+            "type": "string",
+            "format": "uri"
         },
         "$schema": {
-            "type": "string"
+            "type": "string",
+            "format": "uri"
         },
         "title": {
             "type": "string"
@@ -135,7 +137,6 @@
                 }
             ]
         },
-        "format": { "type": "string" },
         "allOf": { "$ref": "#/definitions/schemaArray" },
         "anyOf": { "$ref": "#/definitions/schemaArray" },
         "oneOf": { "$ref": "#/definitions/schemaArray" },

Thanks!

ottomata commented 1 month ago

Very strange that these are different! I'd assume draft4/schema should be verbatim from jsonschema spec.

It looks like the format line should be included. https://json-schema.org/draft-04/schema

ottomata commented 1 month ago

Submitted MR to fix. Latest commit on this repo is 4 years ago though... Dunno if anyone is listening.