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 397 forks source link

Json Schema validator show error #263

Open NABEEL-AHMED-JAMIL opened 6 years ago

NABEEL-AHMED-JAMIL commented 6 years ago

Hi, All need help i'm new on schema base validation while implement this schema and run my code it's show this error.

ERROR

valid=falseresult=com.github.fge.jsonschema.core.report.ListProcessingReport: failure
--- BEGIN MESSAGES ---
error: instance matched a schema which it should not have
    level: "error"
    schema: {"loadingURI":"#","pointer":""}
    instance: {"pointer":""}
    domain: "validation"
    keyword: "not"
---  END MESSAGES  ---

Schema input

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "title": "event fire request v1",
  "description": "json-schema for event fire request v1",
  "type": "object",
  "required": ["userId", "phone", "userName"],
  "not": {
    "allOf": [{
      "required": ["role"]
    }, {
      "required": ["video"]
    }]
  },
  "properties": {
    "userId": {
      "type": "string"
    },
    "phone": {
      "type": "string"
    },
    "userName": {
      "type": "string"
    },
    "role": {
      "type": "object",
      "required": ["roleId", "name"],
      "properties": {
        "roleId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }    },
    "video": {
      "type": "object",
      "required": ["videoId", "h", "w"],
      "properties": {
        "videoId": {
          "type": "string"
        },
        "h": {
          "type": "string"
        },
        "w": {
          "type": "string"
        }
      }
    }
  }
}

Dependency

<dependency>
       <groupId>com.github.java-json-tools</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>2.2.10</version>
</dependency>
huggsboson commented 6 years ago

We don't support draft-07 as of this moment, and I haven't seen any PR's attempting to implement the newer drafts, so can't give you any ETS when that might come available.

On Fri, May 18, 2018, 12:48 AM Nabeel Ahemd notifications@github.com wrote:

Hi, All need help i'm new on schema base validation while implement this schema and run my code it's show this error. ERROR

valid=falseresult=com.github.fge.jsonschema.core.report.ListProcessingReport: failure --- BEGIN MESSAGES --- error: instance matched a schema which it should not have level: "error" schema: {"loadingURI":"#","pointer":""} instance: {"pointer":""} domain: "validation" keyword: "not" --- END MESSAGES ---

Schema input

{ "$schema": "http://json-schema.org/draft-07/schema", "title": "event fire request v1", "description": "json-schema for event fire request v1", "type": "object", "required": ["userId", "phone", "userName"], "not": { "allOf": [{ "required": ["role"] }, { "required": ["video"] }] }, "properties": { "userId": { "type": "string" }, "phone": { "type": "string" }, "userName": { "type": "string" }, "role": { "type": "object", "required": ["roleId", "name"], "properties": { "roleId": { "type": "string" }, "name": { "type": "string" } } }, "video": { "type": "object", "required": ["videoId", "h", "w"], "properties": { "videoId": { "type": "string" }, "h": { "type": "string" }, "w": { "type": "string" } } } } }

Dependency

com.github.java-json-tools json-schema-validator 2.2.10

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/java-json-tools/json-schema-validator/issues/263, or mute the thread https://github.com/notifications/unsubscribe-auth/ADUzzMH9RQj-AXeEbWV-OT7D5e0e1_vnks5tznzrgaJpZM4UER-2 .

NABEEL-AHMED-JAMIL commented 6 years ago

Thansk @huggsboson but i also try with the draft-04 it's same not work.

ft0907 commented 5 years ago

When can support draft-07?