Recursive external $ref gets resolved to itself when `bundle`
See original GitHub issueInput:
openapi: 3.0.2
info:
version: 1.0.0
title: Reproduction sample
description: OpenAPI sample that exposes the problem
paths:
/:
get:
description: get
responses:
default:
description: response
content: {}
components:
schemas:
Link:
$ref: https://json-schema.org/draft-04/hyper-schema#/definitions/linkDescription
Code:
const parser = new JsonSchemaRefParser();
const spec = await parser.bundle(spec);
Output:
openapi: 3.0.2
info:
version: 1.0.0
title: Reproduction sample
description: OpenAPI sample that exposes the problem
paths:
"/":
get:
description: get
responses:
default:
description: response
content: {}
components:
schemas:
Link: # see bellow
"$ref": "#/components/schemas/Link/properties/schema/properties/not/definitions/linkDescription"
It most likely has something to do with the fact that the ref is recursive.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Why does git fail to fetch specific valid submodule for a given ...
Running this command after cloning (and receiving the error) solved my problem: git submodule update --force --recursive --init --remote.
Read more >Structuring a complex schema — Understanding JSON ...
When evaluating a $ref , an implementation uses the resolved identifier to retrieve the referenced schema and applies that schema to the instance....
Read more >How to use the acorn/dist/walk.recursive function in acorn - Snyk
To help you get started, we've selected a few acorn examples, based on popular ways it is used in public projects. ; function...
Read more >utils/tools.py - external/swarming.client - Git at Google
Recursive calls count as a single call (i.e. only the time spent in the outer. call is recorded). Autoregisters itself in a global...
Read more >Sub::Recursive - Anonymous memory leak free ... - MetaCPAN
This particular example isn't a closure as it doesn't reference any lexicals outside itself (and thus could've been written as a named subroutine)....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not sure what you mean, I wasn’t offering options. The first code block was how I would expect it to be resolved, as you were expecting a “definitions” to be created for you by json-schema-ref-resolver and that’s not how it works.
The second code block was me asking if you could try something out to see if it also created unexpected behavior. I was not at this point suggesting you change everything at your company. 😃
Weird. Thanks for reporting it. Will investigate.