Skip to content

Commit 2c624f4

Browse files
committed
get openAPI component working
1 parent c56137b commit 2c624f4

File tree

18 files changed

+710
-45
lines changed

18 files changed

+710
-45
lines changed

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: actions/checkout@v3
2929
- uses: actions/[email protected]
3030
with:
31-
node-version: '16.10.0'
31+
node-version: '20.11.0'
3232
cache: 'yarn'
3333
- name: Install Dependencies
3434
run: yarn --frozen-lockfile

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Use Node.js
2121
uses: actions/[email protected]
2222
with:
23-
node-version: '16.10.0'
23+
node-version: '20.11.0'
2424
registry-url: https://registry.npmjs.org/
2525
cache: 'yarn'
2626

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-latest]
21-
node-version: ['16.10.0']
21+
node-version: ['20.11.0']
2222

2323
steps:
2424
- uses: actions/checkout@v3
@@ -59,7 +59,7 @@ jobs:
5959
- name: Use Node.js
6060
uses: actions/setup-node@v3
6161
with:
62-
node-version: '16.10.0'
62+
node-version: '20.11.0'
6363
cache: 'yarn'
6464
- name: Install Dependencies
6565
run: yarn --frozen-lockfile

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
"@types/jest": "^29.1.2",
5858
"@types/lodash-es": "^4.17.6",
5959
"@types/node": "^18.0.0",
60+
"@types/react": "^18.2.46",
61+
"@types/react-dom": "^18.2.18",
6062
"@typescript-eslint/eslint-plugin": "^6.7.4",
6163
"@typescript-eslint/parser": "^6.7.4",
6264
"@vanilla-extract/esbuild-plugin": "^2.3.1",
@@ -99,6 +101,7 @@
99101
"resolutions": {
100102
"@braintree/sanitize-url": "^6.0.0",
101103
"@types/react": "^18.2.46",
104+
"@types/react-dom": "^18.2.18",
102105
"commander": "^9.4.0",
103106
"json5": "^1.0.2",
104107
"@salt-ds/lab": "1.0.0-alpha.25"

packages/mdx-components/src/BlockQuote/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import classnames from 'clsx';
33

4-
import { P2 } from '@jpmorganchase/mosaic-components';
54
import styles from './index.css';
65

76
export interface BlockQuoteProps extends React.HTMLProps<HTMLDivElement> {}
@@ -15,7 +14,7 @@ export const BlockQuote: React.FC<React.PropsWithChildren<BlockQuoteProps>> = ({
1514
return (
1615
<div className={classnames(className, styles.root)}>
1716
<div className={styles.watermark} />
18-
<P2>{rawChildren}</P2>
17+
<span>{rawChildren}</span>
1918
</div>
2019
);
2120
};

packages/open-api-component/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"default": "./dist/index.js"
2424
}
2525
},
26+
"engines": {
27+
"node": ">=20.0.0"
28+
},
2629
"scripts": {
2730
"build": "npm-run-all --parallel build:*",
2831
"build:bundle": "node ../../scripts/bundle.mjs",
@@ -42,7 +45,7 @@
4245
"@vanilla-extract/sprinkles": "^1.6.1",
4346
"@vanilla-extract/recipes": "^0.5.1",
4447
"@types/swagger-ui-react": "^4.18.0",
45-
"swagger-ui-react": "^5.0.0",
48+
"swagger-ui-react": "^5.11.0",
4649
"clsx": "^2.0.0",
4750
"deepmerge": "^2.0.1",
4851
"lodash-es": "^4.17.21",

packages/open-api-component/src/IsomorphicSuspense.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/open-api-component/src/OpenAPI/SwaggerUi.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
'use client';
2+
13
/**
24
* Keep this separate.
35
* We want this to be loaded on the client and not the server to prevent
46
* issues with swagger-ui-react dependencies.
7+
*
8+
* Also, swagger-ui-react needs node 20 to work
9+
* See --> https://github.com/swagger-api/swagger-ui/issues/8245#issuecomment-1707703135
10+
*
511
*/
612

713
import SwaggerUI from 'swagger-ui-react';
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import React, { lazy } from 'react';
2-
3-
import { IsomorphicSuspense } from '../IsomorphicSuspense';
1+
import React, { lazy, Suspense } from 'react';
42

53
export interface OpenAPIProps {
64
/** Additional class name for root class override */
@@ -12,7 +10,7 @@ export interface OpenAPIProps {
1210
const LazySwagger = lazy(() => import('./SwaggerUi'));
1311

1412
export const OpenAPI: React.FC<React.PropsWithChildren<OpenAPIProps>> = ({ url }) => (
15-
<IsomorphicSuspense fallback={<span>Loading Swagger component...</span>}>
13+
<Suspense fallback={<span>Loading Swagger component...</span>}>
1614
<LazySwagger url={url} />
17-
</IsomorphicSuspense>
15+
</Suspense>
1816
);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import './styles.css';
2+
import 'swagger-ui-react/swagger-ui.css';
3+
4+
export * from './OpenAPI/index';

0 commit comments

Comments
 (0)