Skip to content

Commit 537b90c

Browse files
authored
Merge pull request #3 from MetaMask/fix/general-fixups
Fix/general fixups
2 parents 90cb948 + e16d4b7 commit 537b90c

File tree

9 files changed

+67
-145
lines changed

9 files changed

+67
-145
lines changed

.circleci/config.yml

-89
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"@rjsf/core": "^5.6.2",
2121
"@rjsf/utils": "^5.6.2",
2222
"@rjsf/validator-ajv8": "^5.6.2",
23-
"@stoplight/json-schema-viewer": "^4.9.0",
2423
"@stoplight/markdown-viewer": "^5",
2524
"@stoplight/mosaic": "^1.32",
2625
"@stoplight/mosaic-code-viewer": "^1.32",
@@ -29,6 +28,7 @@
2928
"jest-transform-css": "^2.0.0",
3029
"json-schema": "^0.2.3",
3130
"lodash": "^4.17.15",
31+
"mm-json-schema-viewer": "^0.0.1",
3232
"qs": "^6.11.1",
3333
"react-markdown": "^8.0.7",
3434
"react-syntax-highlighter": "^15.4.3"

src/ContentDescriptor/ContentDescriptor.css

+4
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ select, input {
4646
#interactive-box input[type=text] {
4747
width: 100%
4848
}
49+
50+
.method section {
51+
margin-bottom: var(--ifm-heading-margin-bottom);
52+
}

src/ContentDescriptor/ContentDescriptor.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import ReactMarkdown from "react-markdown";
44
import { ContentDescriptorObject } from "@open-rpc/meta-schema";
55
import "./ContentDescriptor.css";
66
import MarkdownDescription from "../MarkdownDescription/MarkdownDescription";
7-
import { JsonSchemaViewer } from "@stoplight/json-schema-viewer";
8-
7+
import { JsonSchemaViewer } from "mm-json-schema-viewer/dist/index";
98

109
interface IProps {
1110
contentDescriptor?: ContentDescriptorObject;
@@ -20,21 +19,20 @@ class ContentDescriptor extends Component<IProps> {
2019
const entries = Object.entries(contentDescriptor);
2120
if (entries.length === 0) { return null; }
2221
return (
23-
<>
22+
<div style={{ paddingLeft: 'var(--ifm-list-left-padding)' }}>
2423
{contentDescriptor.description &&
2524
<MarkdownDescription
2625
uiSchema={uiSchema}
2726
source={contentDescriptor.description}
2827
className="content-descriptor-description"
2928
/>
3029
}
31-
<h4 style={{marginBottom: "0px"}}>Schema:</h4>
3230
{contentDescriptor.schema &&
3331
<JsonSchemaViewer
3432
schema={contentDescriptor.schema}
3533
/>
3634
}
37-
</>
35+
</div>
3836
);
3937

4038
/* return (

src/Errors/Errors.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Errors extends Component<IProps> {
1515
return null;
1616
}
1717
return (
18-
<ExpansionTable headers={["Code", "Message", "Data"]}>
18+
<ExpansionTable headers={["Code", "Message"]}>
1919
{errors.map((row) => (
2020
<tr>
2121
<td>{row.code}</td>

src/InteractiveMethod/InteractiveMethod.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ const InteractiveMethod: React.FC<Props> = (props) => {
244244
}
245245
</div>}
246246
<div>
247-
<button className="button button--primary button--block" onClick={handleExec}>Execute</button>
247+
<button className="button button--primary button--block" onClick={handleExec}>
248+
Send Request
249+
</button>
248250
</div>
249251
</>
250252
);

src/Method/Method.tsx

+39-32
Original file line numberDiff line numberDiff line change
@@ -54,43 +54,48 @@ const Method = ({method, uiSchema, key, methodPlugins, reactJsonOptions, onExamp
5454
<div
5555
id={method.name}
5656
key={key}
57-
className="margin-bottom--sm"
58-
>
57+
className="method margin-bottom--sm"
58+
>
5959

60-
<div style={{marginBottom: "var(--ifm-heading-margin-bottom)"}}>
61-
<h1 key={method.name} className="method-name" style={{display: "inline", marginRight: "3px"}}>{method.name}</h1>
60+
<h1 key={method.name} className="method-name" style={{ display: "inline", marginRight: "3px"}}>{method.name}</h1>
6261

63-
<span key={method.summary} className="method-summary">
64-
{method.summary}
65-
</span>
66-
</div>
67-
68-
{method.tags && method.tags.length > 0 &&
69-
<section key="tags">
70-
<Tags tags={method.tags as any} />
71-
</section>
62+
{method.tags && method.tags.length > 0 && <section key="tags">
63+
<Tags tags={method.tags as any} />
64+
</section>
7265
}
73-
{method.description &&
66+
67+
{method.description ?
7468
<section key="description">
7569
<MarkdownDescription
7670
uiSchema={uiSchema}
7771
source={method.description}
7872
className="method-description"
7973
/>
8074
</section>
75+
: method.summary ?
76+
<p key={method.summary} className="method-summary">
77+
{method.summary}
78+
</p>
79+
: null
8180
}
82-
{method.params && method.params.length > 0 &&
83-
<section key="params">
81+
<section key="params">
8482
<div style={{marginBottom: "var(--ifm-heading-margin-bottom)"}}>
85-
<h2 style={{ display: 'inline', marginRight: '3px' }}>Params</h2>
86-
<span>({method.params.length})</span>
83+
<h2 style={{ display: 'inline', marginRight: '3px' }}>Params</h2>
84+
<span>({method.params.length})</span>
8785
</div>
86+
87+
{method.params && method.params.length > 0 &&
8888
<Params params={method.params as ContentDescriptorObject[]} uiSchema={uiSchema} />
89-
</section>
90-
}
89+
}
90+
</section>
91+
9192
{method.result &&
9293
<section key="result-title">
93-
<h2>Result</h2>
94+
<div style={{marginBottom: "var(--ifm-heading-margin-bottom)"}}>
95+
<h2 style={{ display: 'inline', marginRight: '3px' }}>Result</h2>
96+
<span><i>({(method.result as ContentDescriptorObject).name})</i></span>
97+
</div>
98+
9499
<ContentDescriptor
95100
contentDescriptor={method.result as ContentDescriptorObject}
96101
hideRequired={true} uiSchema={uiSchema} />
@@ -103,19 +108,21 @@ const Method = ({method, uiSchema, key, methodPlugins, reactJsonOptions, onExamp
103108
</section>
104109
}
105110

106-
<br />
107-
108111
{method.examples && method.examples.length > 0 &&
109112
<section key="examples">
110-
<h2>Examples</h2>
111-
<ExamplePairings
112-
uiSchema={uiSchema}
113-
components={components}
114-
examples={method.examples as ExamplePairingObject[]}
115-
onExamplePairingChange={onExamplePairingChange}
116-
method={method}
117-
reactJsonOptions={reactJsonOptions} />
118-
</section>
113+
<div style={{marginBottom: "var(--ifm-heading-margin-bottom)"}}>
114+
<h2 style={{ marginRight: '3px' }}>
115+
{ (method.examples as ExamplePairingObject[]).length > 1 ? "Examples" : "Example" }
116+
</h2>
117+
</div>
118+
<ExamplePairings
119+
uiSchema={uiSchema}
120+
components={components}
121+
examples={method.examples as ExamplePairingObject[]}
122+
onExamplePairingChange={onExamplePairingChange}
123+
method={method}
124+
reactJsonOptions={reactJsonOptions} />
125+
</section>
119126
}
120127

121128
{links && links.length > 0 &&

src/Params/Params.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Params extends Component<IProps> {
1717
}
1818
return (
1919
params.map((row, i) =>
20-
<>
20+
<section>
2121
<h3>
2222
{i + 1}. {row.name}
2323
{
@@ -35,7 +35,7 @@ class Params extends Component<IProps> {
3535
contentDescriptor={row}
3636
uiSchema={uiSchema}
3737
/>
38-
</>
38+
</section>
3939
)
4040
);
4141
}

yarn.lock

+14-14
Original file line numberDiff line numberDiff line change
@@ -859,20 +859,6 @@
859859
"@types/json-schema" "^7.0.7"
860860
magic-error "0.0.1"
861861

862-
"@stoplight/json-schema-viewer@^4.9.0":
863-
version "4.9.0"
864-
resolved "https://registry.yarnpkg.com/@stoplight/json-schema-viewer/-/json-schema-viewer-4.9.0.tgz#3009e6a9af77756017f48ea3f1ee3e3012f63da0"
865-
integrity sha512-xuOt1FFeFxiy/bJrD0++9rjKY0NlaxH7y6jDZGCMGmH0y2vykpC2ZbHji+ol7/rB5TvVp7oE0NwlpK8TVizinw==
866-
dependencies:
867-
"@stoplight/json" "^3.20.1"
868-
"@stoplight/json-schema-tree" "^2.2.2"
869-
"@stoplight/react-error-boundary" "^2.0.0"
870-
"@types/json-schema" "^7.0.7"
871-
classnames "^2.2.6"
872-
fnv-plus "^1.3.1"
873-
jotai "^1.4.5"
874-
lodash "^4.17.19"
875-
876862
"@stoplight/json@^3.12.0", "@stoplight/json@^3.20.1":
877863
version "3.20.2"
878864
resolved "https://registry.yarnpkg.com/@stoplight/json/-/json-3.20.2.tgz#466ba5c6381cfd141f1726439442fbd579804c8e"
@@ -3800,6 +3786,20 @@ mkdirp@^0.5.1:
38003786
dependencies:
38013787
minimist "^1.2.6"
38023788

3789+
mm-json-schema-viewer@^0.0.1:
3790+
version "0.0.1"
3791+
resolved "https://registry.yarnpkg.com/mm-json-schema-viewer/-/mm-json-schema-viewer-0.0.1.tgz#995b60f211ecfeee604fa24cc965340a251f8ad3"
3792+
integrity sha512-Nmly2cwMyIxNIBEPO7Bu9TzcdeuL0gj3ogfB+SWZPGjiXqwHBphMHkR2uPgnL+RPDycs6bS8j/qXDkMN8FYWPw==
3793+
dependencies:
3794+
"@stoplight/json" "^3.20.1"
3795+
"@stoplight/json-schema-tree" "^2.2.2"
3796+
"@stoplight/react-error-boundary" "^2.0.0"
3797+
"@types/json-schema" "^7.0.7"
3798+
classnames "^2.2.6"
3799+
fnv-plus "^1.3.1"
3800+
jotai "^1.4.5"
3801+
lodash "^4.17.19"
3802+
38033803
mri@^1.1.0:
38043804
version "1.2.0"
38053805
resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b"

0 commit comments

Comments
 (0)