Skip to content

Commit

Permalink
fix: handling nested schemas with allof (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpodlasin authored Apr 7, 2021
1 parent 5e8af68 commit a60a6d3
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@stoplight/json": "^3.10.0",
"@stoplight/json-schema-tree": "^1.1.2",
"@stoplight/json-schema-tree": "^1.1.3",
"@stoplight/mosaic": "^1.0.0-beta.36",
"@stoplight/react-error-boundary": "^1.0.0",
"classnames": "^2.2.6",
Expand Down
21 changes: 21 additions & 0 deletions src/__fixtures__/references/nested.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$ref": "#/__bundled__/repo",
"__bundled__": {
"repo": {
"properties": {
"parent": {
"allOf": [
{
"$ref": "#/__bundled__/repo"
},
{
"description": "something"
}
]
}
},
"type": "object"
}
}
}

59 changes: 59 additions & 0 deletions src/__tests__/__snapshots__/index.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3249,6 +3249,65 @@ exports[`HTML Output should match references/base.json 1`] = `
"
`;
exports[`HTML Output should match references/nested.json 1`] = `
"<div class=\\"\\">
<div class=\\"JsonSchemaViewer\\">
<div style=\\"margin-left: 20px\\">
<div>
<div>
<div>
<div>
<div style=\\"width: 20px; height: 20px; position: relative; left: -7px\\" role=\\"button\\"></div>
<div><span>object</span></div>
</div>
</div>
</div>
<div></div>
</div>
<div>
<div style=\\"margin-left: 20px\\">
<div>
<div>
<div>
<div>
<div style=\\"width: 20px; height: 20px; left: -27px\\" role=\\"button\\"></div>
<div>
<div>parent</div>
<span>object</span>
</div>
</div>
<div><div title=\\"something\\">something</div></div>
</div>
</div>
<div></div>
</div>
<div>
<div style=\\"margin-left: 20px\\">
<div>
<div>
<div>
<div>
<div style=\\"width: 20px; height: 20px; left: -27px\\" role=\\"button\\"></div>
<div>
<div>parent</div>
<span>object</span>
</div>
</div>
<div><div title=\\"something\\">something</div></div>
</div>
</div>
<div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
"
`;
exports[`HTML Output should match references/nullish.json 1`] = `
"<div class=\\"\\">
<div class=\\"JsonSchemaViewer\\">
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2265,10 +2265,10 @@
json-schema-compare "^0.2.2"
lodash "^4.17.4"

"@stoplight/json-schema-tree@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@stoplight/json-schema-tree/-/json-schema-tree-1.1.2.tgz#c781de4322f286b296fe82233dd4b895cedb10a7"
integrity sha512-GgEJApU2/JKVd3XwjPP52gI9EGCi1nFz4fPUTw1gafpAnEqQcjVF14RFlJ+YjMx15ggwsUPCDEZIypDEoYvdoA==
"@stoplight/json-schema-tree@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@stoplight/json-schema-tree/-/json-schema-tree-1.1.3.tgz#c2aafa1b10c506e7ebec7a4904ff3bd325f7102f"
integrity sha512-n/mmhLEu4qrZO/UxQBYyPNid2v4Zq6fuzUK9pBMpNxQtxXmmge62lFWDnc3Q8nzXwRio0OPuMmZS9RO0Q0hmOg==
dependencies:
"@stoplight/json" "^3.10.0"
"@stoplight/json-schema-merge-allof" "^0.7.5"
Expand Down

0 comments on commit a60a6d3

Please sign in to comment.