json-refs icon indicating copy to clipboard operation
json-refs copied to clipboard

`resolveCirculars` doesn't work

Open DetachHead opened this issue 1 year ago • 2 comments

import { resolveRefs } from 'json-refs'

const resolved = await resolveRefs(
    {
        $ref: '#/definitions/Foo',
        definitions: {
            Foo: {
                type: 'object',
                properties: {
                    a: {
                        $ref: '#/definitions/Foo',
                    },
                },
            },
        },
    },
    { resolveCirculars: true },
)
C:\project\node_modules\json-refs\index.js:139
      throw Error('JSON Pointer points to missing location: ' + pathToPtr(path));
            ^

Error: JSON Pointer points to missing location: #/definitions/Foo/properties
    at C:\project\node_modules\json-refs\index.js:139:13
    at Array.forEach (<anonymous>)
    at findValue (C:\project\node_modules\json-refs\index.js:135:8)
    at setValue (C:\project\node_modules\json-refs\index.js:422:3)
    at C:\project\node_modules\json-refs\index.js:1045:11
    at C:\project\node_modules\lodash\lodash.js:4967:15
    at baseForOwn (C:\project\node_modules\lodash\lodash.js:3032:24)
    at Function.forOwn (C:\project\node_modules\lodash\lodash.js:13082:24)
    at C:\project\node_modules\json-refs\index.js:1037:9
    at async file:///C:/project/asdf.js:3:18

DetachHead avatar Mar 30 '23 07:03 DetachHead