question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include failing property in violation json

See original GitHub issue

I am migrating from the older json-schema-validator. The detail of a violation is slightly less detailed. For example in yours,

{
  "schemaLocation": "#",
  "pointerToViolation": "#",
  "causingExceptions": [
    {
      "schemaLocation": "#/properties/document",
      "pointerToViolation": "#/document",
      "causingExceptions": [],
      "keyword": "required",
      "message": "required key [name] not found"
    }
  ],
  "keyword": "allOf",
  "message": "#: only 1 subschema matches out of 2"
}

whereas the older library outputs:

{
  "level": "error",
  "schema": {
    "loadingURI": "/1.0/entities/metadata/document.json#",
    "pointer": "/properties/document"
  },
  "instance": {
    "pointer": "/document"
  },
  "domain": "validation",
  "keyword": "required",
  "message": "object has missing required properties ([\"name\"])",
  "required": [
    "name"
  ],
  "missing": [
    "name"
  ]
}

To extract the name property I will have to parse the message, rather than the key being available directly.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
ben-manescommented, Feb 3, 2019

Yes, I’m not asking for backwards incompatible changes but enough details to easily extract out all of the information. If this is planned then you can close this, and thanks!

1reaction
erosbcommented, Aug 13, 2019

Hello @doko123 this error message doesn’t look any familiar for me. Probably you are looking at the wrong project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Json schema does not fail if properties of schema and json file ...
1 Answer 1 ... "address": { "type": "object", "additionalProperties": false,. in this case adding an extra category property to the address will ...
Read more >
12.18.7 JSON Schema Validation Functions
If the JSON document fails validation, the function returns a JSON object which includes the properties listed here: valid : Always "false" for...
Read more >
JSON validation - IBM
To ensure that misspelled and unwanted JSON objects and properties are detected by validation, set the "additionalProperties": "false" property in the JSON ......
Read more >
HTTP status and error codes for JSON | Cloud Storage
Failed requests return status codes in the 4xx and 5xx ranges. ... Error responses usually include a JSON document in the response body,...
Read more >
Json Schema Property Names - iT1 Source
documents conforming to JSON Schema Draft 4 specification The problem is that I want to add all JSON property names and. This allows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found