Skip to content

Commit 0635f1f

Browse files
committed
feat: integrate @stoplight/json-schema-tree (#91)
BREAKING CHANGE: shouldResolveEagerly prop has been removed
1 parent b21ded8 commit 0635f1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2298
-4930
lines changed

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"**/*"
1818
],
1919
"engines": {
20-
"node": ">=10.0"
20+
"node": ">=10.18"
2121
},
2222
"scripts": {
2323
"build": "sl-scripts bundle --sourcemap",
@@ -43,14 +43,12 @@
4343
},
4444
"dependencies": {
4545
"@stoplight/json": "^3.10.0",
46-
"@stoplight/json-schema-merge-allof": "^0.7.2",
46+
"@stoplight/json-schema-tree": "^1.0.0",
4747
"@stoplight/react-error-boundary": "^1.0.0",
4848
"@stoplight/tree-list": "^5.0.3",
49-
"classnames": "^2.2.6",
50-
"lodash": "^4.17.15"
49+
"classnames": "^2.2.6"
5150
},
5251
"devDependencies": {
53-
"@rollup/plugin-commonjs": "^11.1.0",
5452
"@rollup/plugin-typescript": "^3.1.1",
5553
"@sambego/storybook-state": "^1.3.6",
5654
"@stoplight/eslint-config": "^1.2.0",
@@ -63,7 +61,6 @@
6361
"@types/enzyme": "^3.10.8",
6462
"@types/jest": "^26.0.18",
6563
"@types/json-schema": "^7.0.6",
66-
"@types/lodash": "^4.14.165",
6764
"@types/node": "^12.7.2",
6865
"@types/react": "16.9.2",
6966
"@types/react-dom": "16.9.0",

rollup.config.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import commonjs from '@rollup/plugin-commonjs';
21
import typescript from '@rollup/plugin-typescript';
3-
import * as path from 'path';
42
import { terser } from 'rollup-plugin-terser';
3+
import * as path from 'path';
54

65
const BASE_PATH = process.cwd();
76

@@ -11,7 +10,6 @@ const plugins = [
1110
include: ['src/**/*.{ts,tsx}'],
1211
}),
1312
terser(),
14-
commonjs(),
1513
];
1614

1715
export default [
@@ -29,14 +27,4 @@ export default [
2927
},
3028
],
3129
},
32-
{
33-
input: path.resolve(BASE_PATH, 'src/tree/index.ts'),
34-
plugins,
35-
output: [
36-
{
37-
file: path.resolve(BASE_PATH, 'dist/tree/index.js'),
38-
format: 'esm',
39-
},
40-
],
41-
},
4230
];
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"$ref": null
2+
"properties": {
3+
"empty-ref": {
4+
"$ref": null
5+
}
6+
}
37
}

src/__stories__/JsonSchemaViewer.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as React from 'react';
88
import { JsonSchemaViewer, RowRenderer, SchemaRow } from '../';
99
import { Wrapper } from './utils/Wrapper';
1010

11-
const allOfSchemaResolved = require('../__fixtures__/allOf/allOf-resolved.json');
11+
const allOfSchema = require('../__fixtures__/combiners/allOfs/base.json');
1212
const schema = require('../__fixtures__/default-schema.json');
1313
const stressSchema = require('../__fixtures__/stress-schema.json');
1414

@@ -20,7 +20,6 @@ storiesOf('JsonSchemaViewer', module)
2020
schema={schema as JSONSchema4}
2121
defaultExpandedDepth={number('defaultExpandedDepth', 0)}
2222
expanded={boolean('expanded', true)}
23-
shouldResolveEagerly={boolean('shouldResolveEagerly', false)}
2423
onGoToRef={action('onGoToRef')}
2524
viewMode={select(
2625
'viewMode',
@@ -36,18 +35,18 @@ storiesOf('JsonSchemaViewer', module)
3635
.add('custom schema', () => (
3736
<JsonSchemaViewer
3837
schema={object('schema', {})}
39-
expanded={boolean('expanded', true)}
38+
defaultExpandedDepth={number('defaultExpandedDepth', 0)}
39+
expanded={boolean('expanded', false)}
4040
onGoToRef={action('onGoToRef')}
4141
maxRows={number('maxRows', 5)}
4242
mergeAllOf={boolean('mergeAllOf', true)}
43-
shouldResolveEagerly={boolean('shouldResolveEagerly', false)}
4443
/>
4544
))
4645
.add('custom row renderer', () => {
4746
const customRowRenderer: RowRenderer = (node, rowOptions) => {
4847
return (
4948
<>
50-
<SchemaRow node={node} rowOptions={rowOptions} />
49+
<SchemaRow treeListNode={node} rowOptions={rowOptions} />
5150
<div className="flex h-full items-center">
5251
<Button className="pl-1 mr-1" small minimal icon={<Icon color="grey" iconSize={12} icon="issue" />} />
5352
<Checkbox className="mb-0" />
@@ -93,7 +92,7 @@ storiesOf('JsonSchemaViewer', module)
9392
))
9493
.add('allOf-schema', () => (
9594
<JsonSchemaViewer
96-
schema={allOfSchemaResolved as JSONSchema4}
95+
schema={allOfSchema as JSONSchema4}
9796
defaultExpandedDepth={number('defaultExpandedDepth', 2)}
9897
expanded={boolean('expanded', false)}
9998
mergeAllOf={boolean('mergeAllOf', true)}

0 commit comments

Comments
 (0)