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.

Ref parser is not resolving direct references.

See original GitHub issue

Following schema will not be resolved.

{
  "$schema": "http://json-schema.org/schema#",
  "$id": "test-schema",
  "definitions": {
    "i_ref_obj": {
      "type": "object",
      "properties": {
        "file": {
          "type": "string"
        }
      },
      "required": [
        "file"
      ]
    }
  },
  "$ref": "#/definitions/i_ref_obj"
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tofusebluecommented, Jun 21, 2017

Well as I interpret it the json-schema.org draft-04 and 06 both specifies $ref as valid attribute on a schema . And as far as “doesn’t” make sense. To me it makes much sense as a shorter syntax of using anyOf with just one reference.

allOf: [ {"$ref": "#/definitions/i_ref_obj"} ]

Note: that my original example is condensed. The real world usage is to reference another schema in combination with “parameters” where the reference is there to extend the referenced schema.

0reactions
Relequestualcommented, May 1, 2019

I can confirm this is correct. Think you can probably close this one =]

Read more comments on GitHub >

github_iconTop Results From Across the Web

json-schema-ref-parser | Yarn - Package Manager
The Problem: You've got a JSON Schema with $ref pointers to other files and/or URLs. Maybe you know all the referenced files ahead...
Read more >
json-schema-ref-parser-kill-circular - npm package - Snyk
Parse, Resolve, and Dereference JSON Schema $ref pointers For more information about how to use this package see README · Ensure you're using...
Read more >
How to preserve references in System.Text.Json
WriteLine( "Tyler is manager of Tyler's first direct report: "); Console. ... For value types, immutable types, and arrays, no reference ...
Read more >
Could not load file or assembly 'Newtonsoft.Json' or one of its ...
i add reference of newtonsoft to my solution.it did not work.then i install json.net (newtonsoft.json) through nuget package manager.Now it is working fine....
Read more >
Intent - Android Developers
Developer Guides; Intent Structure; Intent Resolution; Standard Activity Actions ... collection determines that there are no more references to the object.
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