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.

Bug when using external references?

See original GitHub issue

Any reason why the following should fail? (see https://github.com/kgryte/is-my-json-valid/blob/master/test/failing.js)

var schema = {
    "id": "test-schema",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Test schema.",
    "type": "object",
    "definitions": {
        "port": {
            "description": "schema for a port",
            "type": "integer",
            "minimum": 1024,
            "maximum": 65536
        }
    },
    "properties": {
        "port": {
            "$ref": "#/definitions/port"
        }
    },
    "required": [
        "port"
    ]
}

Test:

tape('external reference', function(t) {
    var validate = validator({
        '$ref': '#ext'
    }, {
        schemas: {'ext':schema}
    })
    t.notOk(validate({}), 'should be invalid') // valid
    t.notOk(validate({port:80}), 'should be invalid') // valid
    t.end()
})

As demonstrated in other tests, validate( 'beep' ) will fail, but for an object having internal reference definitions, these are not being resolved.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
emilbayescommented, May 28, 2016

I just confirmed this and had a look at the generated code. I’ll try to solve this in the coming week

0reactions
baleevskiycommented, Jul 24, 2017

Any updates on this? Facing the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error from Excel External Reference Formula
Using Office 365, I have a worksheet where cell's contain formula's that point to information (a table of address information related to an...
Read more >
The Danger of External References While Using Microsoft Excel
This is why using of external references within an Excel document should be handled carefully. The problem happens when you don't know what ......
Read more >
External reference (xref) file is missing or unresolved in ...
Opening a drawing shows a message about missing xrefs. "One or more referenced files could not be located or read. What do you...
Read more >
Problem with External References | Chandoo.org Excel Forums
Hello folks, hopefully someone out there can help me with a problem I'm having using external references within a formula.
Read more >
How to fix Autocad Xref problems - YouTube
How to fix Autocad Xref problems - External Reference Issues in AutocadIn this tutorial, I share how to fix external reference problem in ......
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