We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allOf
originalFragment
$ref
I want to determine whether a node is a ref node by checking if its parent includes $ref.
my schema:
{ "type": "object", "properties": { "user": { "allOf": [ { "$ref": "#/definitions/employee" } ] } }, "definitions": { "employee": { "type": "object", "properties": { "company": { "$ref": "#/definitions/company" } } }, "company": { "type": "object", "properties": { "name": { "type": "string", "description": "The company's name", "default": "Unknown" } } } } }
I want to determine if user.company.name originates from a $ref, but there is not $ref in parent's originalFragment:
user.company.name
The originalFragment should include all of the schema's original info.
my js code:
import { SchemaTree } from "@stoplight/json-schema-tree"; const mySchema = { type: "object", properties: { user: { allOf: [ { $ref: "#/definitions/employee", }, ], }, }, definitions: { employee: { type: "object", properties: { company: { $ref: "#/definitions/company", }, }, }, company: { type: "object", properties: { name: { type: "string", description: "The company's name", default: "Unknown", }, }, }, }, }; const tree = new SchemaTree(mySchema); tree.walker.hookInto("stepIn", (node) => { console.log("************************"); console.log("path: ", node.path, " node: ", node); console.log("************************"); return true; }); tree.populate();
"@stoplight/json-schema-tree": "^4.0.0"
issue ref: stoplightio/json-schema-viewer#253
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Context
I want to determine whether a node is a ref node by checking if its parent includes
$ref
.my schema:
Current Behavior
I want to determine if
user.company.name
originates from a$ref
, but there is not$ref
in parent'soriginalFragment
:Expected Behavior
The
originalFragment
should include all of the schema's original info.Possible Workaround/Solution
Steps to Reproduce
my js code:
Environment
"@stoplight/json-schema-tree": "^4.0.0"
issue ref: stoplightio/json-schema-viewer#253
The text was updated successfully, but these errors were encountered: