@gitbook/react-openapi 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/InteractiveSection.d.ts +0 -2
- package/dist/InteractiveSection.jsx +3 -4
- package/dist/OpenAPICodeSample.jsx +4 -4
- package/dist/OpenAPICodeSampleInteractive.d.ts +4 -3
- package/dist/OpenAPICodeSampleInteractive.jsx +22 -15
- package/dist/OpenAPICopyButton.d.ts +7 -0
- package/dist/OpenAPICopyButton.jsx +6 -6
- package/dist/OpenAPIOperation.jsx +21 -1
- package/dist/OpenAPIPath.jsx +2 -2
- package/dist/OpenAPIRequestBody.jsx +1 -1
- package/dist/OpenAPIResponse.jsx +1 -1
- package/dist/OpenAPIResponses.jsx +2 -2
- package/dist/OpenAPISchema.d.ts +5 -14
- package/dist/OpenAPISchema.jsx +79 -28
- package/dist/OpenAPISchemaName.jsx +1 -0
- package/dist/OpenAPISchemaServer.d.ts +12 -0
- package/dist/OpenAPISchemaServer.jsx +8 -0
- package/dist/OpenAPISpec.d.ts +0 -6
- package/dist/OpenAPISpec.jsx +5 -11
- package/dist/OpenAPITabs.jsx +3 -11
- package/dist/code-samples.js +44 -9
- package/dist/decycle.d.ts +2 -0
- package/dist/decycle.js +70 -0
- package/dist/schemas/OpenAPISchemas.jsx +1 -1
- package/dist/schemas/resolveOpenAPISchemas.d.ts +2 -6
- package/dist/schemas/resolveOpenAPISchemas.js +1 -21
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types.d.ts +2 -5
- package/package.json +1 -1
- package/src/InteractiveSection.tsx +2 -6
- package/src/OpenAPICodeSample.tsx +16 -5
- package/src/OpenAPICodeSampleInteractive.tsx +53 -28
- package/src/OpenAPICopyButton.tsx +17 -4
- package/src/OpenAPIOperation.tsx +39 -2
- package/src/OpenAPIPath.tsx +2 -2
- package/src/OpenAPIRequestBody.tsx +1 -1
- package/src/OpenAPIResponse.tsx +4 -4
- package/src/OpenAPIResponses.tsx +1 -5
- package/src/OpenAPISchema.tsx +152 -58
- package/src/OpenAPISchemaName.tsx +3 -0
- package/src/OpenAPISchemaServer.tsx +34 -0
- package/src/OpenAPISpec.tsx +13 -11
- package/src/OpenAPITabs.tsx +3 -13
- package/src/code-samples.test.ts +69 -1
- package/src/code-samples.ts +45 -9
- package/src/decycle.ts +68 -0
- package/src/schemas/OpenAPISchemas.tsx +1 -1
- package/src/schemas/resolveOpenAPISchemas.ts +3 -31
- package/src/types.ts +6 -6
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenAPICustomOperationProperties, OpenAPICustomSpecProperties, OpenAPIV3 } from '@gitbook/openapi-parser';
|
|
1
|
+
import type { OpenAPICustomOperationProperties, OpenAPICustomSpecProperties, OpenAPISchema, OpenAPIV3 } from '@gitbook/openapi-parser';
|
|
2
2
|
export interface OpenAPIContextProps extends OpenAPIClientContext {
|
|
3
3
|
/**
|
|
4
4
|
* Render a code block.
|
|
@@ -13,6 +13,7 @@ export interface OpenAPIContextProps extends OpenAPIClientContext {
|
|
|
13
13
|
renderHeading: (props: {
|
|
14
14
|
deprecated: boolean;
|
|
15
15
|
title: string;
|
|
16
|
+
stability?: string;
|
|
16
17
|
}) => React.ReactNode;
|
|
17
18
|
/**
|
|
18
19
|
* Render the document of the operation.
|
|
@@ -51,10 +52,6 @@ export interface OpenAPIOperationData extends OpenAPICustomSpecProperties {
|
|
|
51
52
|
/** Securities that should be used for this operation */
|
|
52
53
|
securities: [string, OpenAPIV3.SecuritySchemeObject][];
|
|
53
54
|
}
|
|
54
|
-
export type OpenAPISchema = {
|
|
55
|
-
name: string;
|
|
56
|
-
schema: OpenAPIV3.SchemaObject;
|
|
57
|
-
};
|
|
58
55
|
export interface OpenAPISchemasData {
|
|
59
56
|
/** Components schemas to be used for schemas */
|
|
60
57
|
schemas: OpenAPISchema[];
|
package/package.json
CHANGED
|
@@ -32,8 +32,6 @@ export function InteractiveSection(props: {
|
|
|
32
32
|
defaultTab?: string;
|
|
33
33
|
/** Content of the header */
|
|
34
34
|
header?: React.ReactNode;
|
|
35
|
-
/** Body of the section */
|
|
36
|
-
children?: React.ReactNode;
|
|
37
35
|
/** Children to display within the container */
|
|
38
36
|
overlay?: React.ReactNode;
|
|
39
37
|
}) {
|
|
@@ -45,7 +43,6 @@ export function InteractiveSection(props: {
|
|
|
45
43
|
tabs = [],
|
|
46
44
|
defaultTab = tabs[0]?.key,
|
|
47
45
|
header,
|
|
48
|
-
children,
|
|
49
46
|
overlay,
|
|
50
47
|
toggleIcon = '▶',
|
|
51
48
|
} = props;
|
|
@@ -83,7 +80,7 @@ export function InteractiveSection(props: {
|
|
|
83
80
|
className={className}
|
|
84
81
|
>
|
|
85
82
|
<SectionHeaderContent className={className}>
|
|
86
|
-
{
|
|
83
|
+
{selectedTab?.body && toggeable ? (
|
|
87
84
|
<button
|
|
88
85
|
{...mergeProps(buttonProps, focusProps)}
|
|
89
86
|
ref={triggerRef}
|
|
@@ -131,9 +128,8 @@ export function InteractiveSection(props: {
|
|
|
131
128
|
</div>
|
|
132
129
|
</SectionHeader>
|
|
133
130
|
) : null}
|
|
134
|
-
{(!toggeable || state.isExpanded) &&
|
|
131
|
+
{(!toggeable || state.isExpanded) && selectedTab?.body ? (
|
|
135
132
|
<SectionBody ref={panelRef} {...panelProps} className={className}>
|
|
136
|
-
{children}
|
|
137
133
|
{selectedTab?.body}
|
|
138
134
|
</SectionBody>
|
|
139
135
|
) : null}
|
|
@@ -148,7 +148,13 @@ function generateCodeSamples(props: {
|
|
|
148
148
|
return {
|
|
149
149
|
key: `default-${generator.id}`,
|
|
150
150
|
label: generator.label,
|
|
151
|
-
body:
|
|
151
|
+
body: (
|
|
152
|
+
<OpenAPIMediaTypeExamplesBody
|
|
153
|
+
method={data.method}
|
|
154
|
+
path={data.path}
|
|
155
|
+
renderers={renderers}
|
|
156
|
+
/>
|
|
157
|
+
),
|
|
152
158
|
footer: (
|
|
153
159
|
<OpenAPICodeSampleFooter renderers={renderers} data={data} context={context} />
|
|
154
160
|
),
|
|
@@ -189,9 +195,10 @@ function OpenAPICodeSampleFooter(props: {
|
|
|
189
195
|
const { method, path } = data;
|
|
190
196
|
const { specUrl } = context;
|
|
191
197
|
const hideTryItPanel = data['x-hideTryItPanel'] || data.operation['x-hideTryItPanel'];
|
|
192
|
-
const
|
|
198
|
+
const hasMultipleMediaTypes =
|
|
199
|
+
renderers.length > 1 || renderers.some((renderer) => renderer.examples.length > 0);
|
|
193
200
|
|
|
194
|
-
if (hideTryItPanel && !
|
|
201
|
+
if (hideTryItPanel && !hasMultipleMediaTypes) {
|
|
195
202
|
return null;
|
|
196
203
|
}
|
|
197
204
|
|
|
@@ -201,8 +208,12 @@ function OpenAPICodeSampleFooter(props: {
|
|
|
201
208
|
|
|
202
209
|
return (
|
|
203
210
|
<div className="openapi-codesample-footer">
|
|
204
|
-
{
|
|
205
|
-
<OpenAPIMediaTypeExamplesSelector
|
|
211
|
+
{hasMultipleMediaTypes ? (
|
|
212
|
+
<OpenAPIMediaTypeExamplesSelector
|
|
213
|
+
method={data.method}
|
|
214
|
+
path={data.path}
|
|
215
|
+
renderers={renderers}
|
|
216
|
+
/>
|
|
206
217
|
) : (
|
|
207
218
|
<span />
|
|
208
219
|
)}
|
|
@@ -3,10 +3,17 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { useStore } from 'zustand';
|
|
5
5
|
import type { MediaTypeRenderer } from './OpenAPICodeSample';
|
|
6
|
-
import type { OpenAPIOperationData } from './types';
|
|
7
6
|
import { getOrCreateTabStoreByKey } from './useSyncedTabsGlobalState';
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
type MediaTypeState = {
|
|
9
|
+
mediaType: string;
|
|
10
|
+
setMediaType: (mediaType: string) => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function useMediaTypeState(
|
|
14
|
+
data: { method: string; path: string },
|
|
15
|
+
defaultKey: string
|
|
16
|
+
): MediaTypeState {
|
|
10
17
|
const { method, path } = data;
|
|
11
18
|
const store = useStore(getOrCreateTabStoreByKey(`media-type-${method}-${path}`, defaultKey));
|
|
12
19
|
if (typeof store.tabKey !== 'string') {
|
|
@@ -18,7 +25,7 @@ function useMediaTypeState(data: OpenAPIOperationData, defaultKey: string) {
|
|
|
18
25
|
};
|
|
19
26
|
}
|
|
20
27
|
|
|
21
|
-
function useMediaTypeSampleIndexState(data:
|
|
28
|
+
function useMediaTypeSampleIndexState(data: { method: string; path: string }, mediaType: string) {
|
|
22
29
|
const { method, path } = data;
|
|
23
30
|
const store = useStore(
|
|
24
31
|
getOrCreateTabStoreByKey(`media-type-sample-${mediaType}-${method}-${path}`, 0)
|
|
@@ -33,40 +40,57 @@ function useMediaTypeSampleIndexState(data: OpenAPIOperationData, mediaType: str
|
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
export function OpenAPIMediaTypeExamplesSelector(props: {
|
|
36
|
-
|
|
43
|
+
method: string;
|
|
44
|
+
path: string;
|
|
37
45
|
renderers: MediaTypeRenderer[];
|
|
38
46
|
}) {
|
|
39
|
-
const {
|
|
47
|
+
const { method, path, renderers } = props;
|
|
40
48
|
if (!renderers[0]) {
|
|
41
49
|
throw new Error('No renderers provided');
|
|
42
50
|
}
|
|
43
|
-
const state = useMediaTypeState(
|
|
51
|
+
const state = useMediaTypeState({ method, path }, renderers[0].mediaType);
|
|
44
52
|
const selected = renderers.find((r) => r.mediaType === state.mediaType) || renderers[0];
|
|
45
53
|
|
|
46
54
|
return (
|
|
47
55
|
<div className="openapi-codesample-selectors">
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
value={state.mediaType}
|
|
51
|
-
onChange={(e) => state.setMediaType(e.target.value)}
|
|
52
|
-
>
|
|
53
|
-
{renderers.map((renderer) => (
|
|
54
|
-
<option key={renderer.mediaType} value={renderer.mediaType}>
|
|
55
|
-
{renderer.mediaType}
|
|
56
|
-
</option>
|
|
57
|
-
))}
|
|
58
|
-
</select>
|
|
59
|
-
<ExamplesSelector data={data} renderer={selected} />
|
|
56
|
+
<MediaTypeSelector state={state} renderers={renderers} />
|
|
57
|
+
<ExamplesSelector method={method} path={path} renderer={selected} />
|
|
60
58
|
</div>
|
|
61
59
|
);
|
|
62
60
|
}
|
|
63
61
|
|
|
62
|
+
function MediaTypeSelector(props: {
|
|
63
|
+
state: MediaTypeState;
|
|
64
|
+
renderers: MediaTypeRenderer[];
|
|
65
|
+
}) {
|
|
66
|
+
const { renderers, state } = props;
|
|
67
|
+
|
|
68
|
+
if (renderers.length < 2) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<select
|
|
74
|
+
className={clsx('openapi-select')}
|
|
75
|
+
value={state.mediaType}
|
|
76
|
+
onChange={(e) => state.setMediaType(e.target.value)}
|
|
77
|
+
>
|
|
78
|
+
{renderers.map((renderer) => (
|
|
79
|
+
<option key={renderer.mediaType} value={renderer.mediaType}>
|
|
80
|
+
{renderer.mediaType}
|
|
81
|
+
</option>
|
|
82
|
+
))}
|
|
83
|
+
</select>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
64
87
|
function ExamplesSelector(props: {
|
|
65
|
-
|
|
88
|
+
method: string;
|
|
89
|
+
path: string;
|
|
66
90
|
renderer: MediaTypeRenderer;
|
|
67
91
|
}) {
|
|
68
|
-
const {
|
|
69
|
-
const state = useMediaTypeSampleIndexState(
|
|
92
|
+
const { method, path, renderer } = props;
|
|
93
|
+
const state = useMediaTypeSampleIndexState({ method, path }, renderer.mediaType);
|
|
70
94
|
if (renderer.examples.length < 2) {
|
|
71
95
|
return null;
|
|
72
96
|
}
|
|
@@ -87,25 +111,26 @@ function ExamplesSelector(props: {
|
|
|
87
111
|
}
|
|
88
112
|
|
|
89
113
|
export function OpenAPIMediaTypeExamplesBody(props: {
|
|
90
|
-
|
|
114
|
+
method: string;
|
|
115
|
+
path: string;
|
|
91
116
|
renderers: MediaTypeRenderer[];
|
|
92
117
|
}) {
|
|
93
|
-
const { renderers,
|
|
118
|
+
const { renderers, method, path } = props;
|
|
94
119
|
if (!renderers[0]) {
|
|
95
120
|
throw new Error('No renderers provided');
|
|
96
121
|
}
|
|
97
|
-
const mediaTypeState = useMediaTypeState(
|
|
122
|
+
const mediaTypeState = useMediaTypeState({ method, path }, renderers[0].mediaType);
|
|
98
123
|
const selected =
|
|
99
124
|
renderers.find((r) => r.mediaType === mediaTypeState.mediaType) ?? renderers[0];
|
|
100
125
|
if (selected.examples.length === 0) {
|
|
101
126
|
return selected.element;
|
|
102
127
|
}
|
|
103
|
-
return <ExamplesBody
|
|
128
|
+
return <ExamplesBody method={method} path={path} renderer={selected} />;
|
|
104
129
|
}
|
|
105
130
|
|
|
106
|
-
function ExamplesBody(props: {
|
|
107
|
-
const {
|
|
108
|
-
const exampleState = useMediaTypeSampleIndexState(
|
|
131
|
+
function ExamplesBody(props: { method: string; path: string; renderer: MediaTypeRenderer }) {
|
|
132
|
+
const { method, path, renderer } = props;
|
|
133
|
+
const exampleState = useMediaTypeSampleIndexState({ method, path }, renderer.mediaType);
|
|
109
134
|
const example = renderer.examples[exampleState.index] ?? renderer.examples[0];
|
|
110
135
|
if (!example) {
|
|
111
136
|
throw new Error(`No example found for index ${exampleState.index}`);
|
|
@@ -6,10 +6,16 @@ import { Button, type ButtonProps, Tooltip, TooltipTrigger } from 'react-aria-co
|
|
|
6
6
|
export function OpenAPICopyButton(
|
|
7
7
|
props: ButtonProps & {
|
|
8
8
|
value: string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether to show a tooltip.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
withTooltip?: boolean;
|
|
9
16
|
}
|
|
10
17
|
) {
|
|
11
|
-
const { value } = props;
|
|
12
|
-
const { children, onPress, className } = props;
|
|
18
|
+
const { value, label, children, onPress, className, withTooltip = true } = props;
|
|
13
19
|
const [copied, setCopied] = useState(false);
|
|
14
20
|
const [isOpen, setIsOpen] = useState(false);
|
|
15
21
|
|
|
@@ -21,12 +27,19 @@ export function OpenAPICopyButton(
|
|
|
21
27
|
|
|
22
28
|
setTimeout(() => {
|
|
23
29
|
setCopied(false);
|
|
30
|
+
setIsOpen(false);
|
|
24
31
|
}, 2000);
|
|
25
32
|
});
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
return (
|
|
29
|
-
<TooltipTrigger
|
|
36
|
+
<TooltipTrigger
|
|
37
|
+
isOpen={isOpen}
|
|
38
|
+
onOpenChange={setIsOpen}
|
|
39
|
+
isDisabled={!withTooltip}
|
|
40
|
+
closeDelay={200}
|
|
41
|
+
delay={200}
|
|
42
|
+
>
|
|
30
43
|
<Button
|
|
31
44
|
type="button"
|
|
32
45
|
preventFocusOnPress
|
|
@@ -47,7 +60,7 @@ export function OpenAPICopyButton(
|
|
|
47
60
|
offset={4}
|
|
48
61
|
className="openapi-tooltip"
|
|
49
62
|
>
|
|
50
|
-
{copied ? 'Copied' : 'Copy to clipboard'}
|
|
63
|
+
{copied ? 'Copied' : label || 'Copy to clipboard'}
|
|
51
64
|
</Tooltip>
|
|
52
65
|
</TooltipTrigger>
|
|
53
66
|
);
|
package/src/OpenAPIOperation.tsx
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
OpenAPICustomOperationProperties,
|
|
5
|
+
OpenAPIStability,
|
|
6
|
+
OpenAPIV3,
|
|
7
|
+
} from '@gitbook/openapi-parser';
|
|
4
8
|
import { Markdown } from './Markdown';
|
|
5
9
|
import { OpenAPICodeSample } from './OpenAPICodeSample';
|
|
6
10
|
import { OpenAPIPath } from './OpenAPIPath';
|
|
@@ -29,14 +33,24 @@ export function OpenAPIOperation(props: {
|
|
|
29
33
|
return (
|
|
30
34
|
<div className={clsx('openapi-operation', className)}>
|
|
31
35
|
<div className="openapi-summary" id={operation.summary ? undefined : context.id}>
|
|
36
|
+
{(operation.deprecated || operation['x-stability']) && (
|
|
37
|
+
<div className="openapi-summary-tags">
|
|
38
|
+
{operation.deprecated && (
|
|
39
|
+
<div className="openapi-deprecated">Deprecated</div>
|
|
40
|
+
)}
|
|
41
|
+
{operation['x-stability'] && (
|
|
42
|
+
<OpenAPIOperationStability stability={operation['x-stability']} />
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
32
46
|
{operation.summary
|
|
33
47
|
? context.renderHeading({
|
|
34
48
|
deprecated: operation.deprecated ?? false,
|
|
49
|
+
stability: operation['x-stability'],
|
|
35
50
|
title: operation.summary,
|
|
36
51
|
})
|
|
37
52
|
: null}
|
|
38
53
|
<OpenAPIPath data={data} context={context} />
|
|
39
|
-
{operation.deprecated && <div className="openapi-deprecated">Deprecated</div>}
|
|
40
54
|
</div>
|
|
41
55
|
<div className="openapi-columns">
|
|
42
56
|
<div className="openapi-column-spec">
|
|
@@ -89,3 +103,26 @@ function OpenAPIOperationDescription(props: {
|
|
|
89
103
|
</div>
|
|
90
104
|
);
|
|
91
105
|
}
|
|
106
|
+
|
|
107
|
+
const stabilityEnum = {
|
|
108
|
+
experimental: 'Experimental',
|
|
109
|
+
alpha: 'Alpha',
|
|
110
|
+
beta: 'Beta',
|
|
111
|
+
stable: 'Stable',
|
|
112
|
+
} as const;
|
|
113
|
+
|
|
114
|
+
function OpenAPIOperationStability(props: { stability: OpenAPIStability }) {
|
|
115
|
+
const { stability } = props;
|
|
116
|
+
|
|
117
|
+
const foundStability = stabilityEnum[stability];
|
|
118
|
+
|
|
119
|
+
if (!foundStability) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div className={`openapi-stability openapi-stability-${foundStability.toLowerCase()}`}>
|
|
125
|
+
{foundStability}
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
}
|
package/src/OpenAPIPath.tsx
CHANGED
|
@@ -47,7 +47,7 @@ function formatPath(path: string) {
|
|
|
47
47
|
parts.push(path.slice(lastIndex, offset));
|
|
48
48
|
}
|
|
49
49
|
parts.push(
|
|
50
|
-
<span key={offset} className="openapi-path-variable">
|
|
50
|
+
<span key={`offset-${offset}`} className="openapi-path-variable">
|
|
51
51
|
{match}
|
|
52
52
|
</span>
|
|
53
53
|
);
|
|
@@ -61,7 +61,7 @@ function formatPath(path: string) {
|
|
|
61
61
|
|
|
62
62
|
const formattedPath = parts.map((part, index) => {
|
|
63
63
|
if (typeof part === 'string') {
|
|
64
|
-
return <span key={index}>{part}</span>;
|
|
64
|
+
return <span key={`part-${index}`}>{part}</span>;
|
|
65
65
|
}
|
|
66
66
|
return part;
|
|
67
67
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
|
2
2
|
import { InteractiveSection } from './InteractiveSection';
|
|
3
|
-
import { OpenAPIRootSchema } from './
|
|
3
|
+
import { OpenAPIRootSchema } from './OpenAPISchemaServer';
|
|
4
4
|
import type { OpenAPIClientContext } from './types';
|
|
5
5
|
import { checkIsReference } from './utils';
|
|
6
6
|
|
package/src/OpenAPIResponse.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
|
2
2
|
import { OpenAPIDisclosure } from './OpenAPIDisclosure';
|
|
3
|
-
import { OpenAPISchemaProperties } from './
|
|
3
|
+
import { OpenAPISchemaProperties } from './OpenAPISchemaServer';
|
|
4
4
|
import type { OpenAPIClientContext } from './types';
|
|
5
5
|
import { parameterToProperty, resolveDescription } from './utils';
|
|
6
6
|
|
|
@@ -29,9 +29,9 @@ export function OpenAPIResponse(props: {
|
|
|
29
29
|
{headers.length > 0 ? (
|
|
30
30
|
<OpenAPIDisclosure context={context} label="Headers">
|
|
31
31
|
<OpenAPISchemaProperties
|
|
32
|
-
properties={headers.map(([name, header]) =>
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
properties={headers.map(([name, header]) =>
|
|
33
|
+
parameterToProperty({ name, ...header })
|
|
34
|
+
)}
|
|
35
35
|
context={context}
|
|
36
36
|
/>
|
|
37
37
|
</OpenAPIDisclosure>
|
package/src/OpenAPIResponses.tsx
CHANGED
|
@@ -27,10 +27,7 @@ export function OpenAPIResponses(props: {
|
|
|
27
27
|
return {
|
|
28
28
|
id: statusCode,
|
|
29
29
|
label: (
|
|
30
|
-
<div
|
|
31
|
-
className="openapi-response-tab-content"
|
|
32
|
-
key={`response-${statusCode}`}
|
|
33
|
-
>
|
|
30
|
+
<div className="openapi-response-tab-content">
|
|
34
31
|
<span className="openapi-response-statuscode">
|
|
35
32
|
{statusCode}
|
|
36
33
|
</span>
|
|
@@ -47,7 +44,6 @@ export function OpenAPIResponses(props: {
|
|
|
47
44
|
label: contentType,
|
|
48
45
|
body: (
|
|
49
46
|
<OpenAPIResponse
|
|
50
|
-
key={`$response-${statusCode}-${contentType}`}
|
|
51
47
|
response={response}
|
|
52
48
|
mediaType={mediaType}
|
|
53
49
|
context={context}
|