@gitbook/react-openapi 1.5.5 → 1.5.6
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 +6 -0
- package/dist/InteractiveSection.js +52 -30
- package/dist/Markdown.js +5 -1
- package/dist/OpenAPICodeSample.js +45 -9
- package/dist/OpenAPICodeSampleInteractive.js +41 -15
- package/dist/OpenAPICodeSampleSelector.js +34 -14
- package/dist/OpenAPICopyButton.js +21 -15
- package/dist/OpenAPIDisclosure.js +18 -10
- package/dist/OpenAPIDisclosureGroup.js +56 -30
- package/dist/OpenAPIExample.js +6 -4
- package/dist/OpenAPIMediaType.js +38 -17
- package/dist/OpenAPIOperation.d.ts +2 -2
- package/dist/OpenAPIOperation.js +26 -12
- package/dist/OpenAPIOperationContext.d.ts +2 -2
- package/dist/OpenAPIOperationContext.js +5 -3
- package/dist/OpenAPIPath.js +14 -5
- package/dist/OpenAPIPathItem.js +26 -12
- package/dist/OpenAPIPathMultipleServers.js +29 -12
- package/dist/OpenAPIPrefillContextProvider.d.ts +2 -1
- package/dist/OpenAPIPrefillContextProvider.js +5 -3
- package/dist/OpenAPIRequestBody.js +20 -10
- package/dist/OpenAPIRequestBodyHeaderType.js +5 -3
- package/dist/OpenAPIRequiredScopes.js +41 -26
- package/dist/OpenAPIResponse.js +34 -19
- package/dist/OpenAPIResponseExample.js +25 -8
- package/dist/OpenAPIResponseExampleContent.js +39 -18
- package/dist/OpenAPIResponses.js +40 -17
- package/dist/OpenAPISchema.js +212 -88
- package/dist/OpenAPISchemaName.js +44 -24
- package/dist/OpenAPISchemaServer.js +10 -2
- package/dist/OpenAPISecurities.js +125 -57
- package/dist/OpenAPISelect.js +27 -18
- package/dist/OpenAPISpec.js +27 -12
- package/dist/OpenAPITooltip.js +14 -6
- package/dist/OpenAPIWebhook.d.ts +2 -2
- package/dist/OpenAPIWebhook.js +23 -11
- package/dist/OpenAPIWebhookExample.js +18 -8
- package/dist/ScalarApiButton.js +50 -29
- package/dist/StaticSection.js +49 -15
- package/dist/common/OpenAPIColumnSpec.js +21 -9
- package/dist/common/OpenAPIOperationDescription.js +12 -6
- package/dist/common/OpenAPIStability.js +6 -3
- package/dist/common/OpenAPISummary.js +23 -12
- package/dist/formatPath.js +7 -4
- package/dist/schemas/OpenAPISchemaItem.js +18 -11
- package/dist/schemas/OpenAPISchemas.d.ts +2 -2
- package/dist/schemas/OpenAPISchemas.js +55 -31
- package/dist/translate.js +4 -6
- package/dist/util/example.js +6 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t, tString } from "./translate.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
|
|
3
4
|
//#region src/OpenAPISchemaName.tsx
|
|
4
5
|
/**
|
|
@@ -8,30 +9,49 @@ import { t, tString } from "./translate.js";
|
|
|
8
9
|
function OpenAPISchemaName(props) {
|
|
9
10
|
const { schema, type, propertyName, required, isDiscriminatorProperty, context } = props;
|
|
10
11
|
const additionalItems = schema && getAdditionalItems(schema, context);
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
13
|
+
className: "openapi-schema-name",
|
|
14
|
+
children: [
|
|
15
|
+
propertyName ? /* @__PURE__ */ jsx("span", {
|
|
16
|
+
"data-deprecated": schema?.deprecated,
|
|
17
|
+
className: "openapi-schema-propertyname",
|
|
18
|
+
children: propertyName
|
|
19
|
+
}) : null,
|
|
20
|
+
isDiscriminatorProperty ? /* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: "openapi-schema-discriminator",
|
|
22
|
+
children: t(context.translation, "discriminator")
|
|
23
|
+
}) : null,
|
|
24
|
+
type || additionalItems ? /* @__PURE__ */ jsxs("span", { children: [schema?.const ? /* @__PURE__ */ jsxs("span", {
|
|
25
|
+
className: "openapi-schema-type",
|
|
26
|
+
children: ["const: ", schema?.const]
|
|
27
|
+
}) : type ? /* @__PURE__ */ jsx("span", {
|
|
28
|
+
className: "openapi-schema-type",
|
|
29
|
+
children: type
|
|
30
|
+
}) : null, additionalItems ? /* @__PURE__ */ jsx("span", {
|
|
31
|
+
className: "openapi-schema-type",
|
|
32
|
+
children: additionalItems
|
|
33
|
+
}) : null] }) : null,
|
|
34
|
+
schema?.readOnly ? /* @__PURE__ */ jsx("span", {
|
|
35
|
+
className: "openapi-schema-readonly",
|
|
36
|
+
children: t(context.translation, "read_only")
|
|
37
|
+
}) : null,
|
|
38
|
+
schema?.writeOnly ? /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "openapi-schema-writeonly",
|
|
40
|
+
children: t(context.translation, "write_only")
|
|
41
|
+
}) : null,
|
|
42
|
+
required === null ? null : required ? /* @__PURE__ */ jsx("span", {
|
|
43
|
+
className: "openapi-schema-required",
|
|
44
|
+
children: t(context.translation, "required")
|
|
45
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: "openapi-schema-optional",
|
|
47
|
+
children: t(context.translation, "optional")
|
|
48
|
+
}),
|
|
49
|
+
schema?.deprecated ? /* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: "openapi-deprecated",
|
|
51
|
+
children: t(context.translation, "deprecated")
|
|
52
|
+
}) : null
|
|
53
|
+
]
|
|
54
|
+
});
|
|
35
55
|
}
|
|
36
56
|
function getAdditionalItems(schema, context) {
|
|
37
57
|
let additionalItems = "";
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { decycle } from "./decycle.js";
|
|
2
2
|
import { OpenAPIRootSchemaFromServer, OpenAPISchemaPropertiesFromServer } from "./OpenAPISchema.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
|
|
4
5
|
//#region src/OpenAPISchemaServer.tsx
|
|
5
6
|
function OpenAPISchemaProperties(props) {
|
|
6
|
-
return
|
|
7
|
+
return /* @__PURE__ */ jsx(OpenAPISchemaPropertiesFromServer, {
|
|
8
|
+
id: props.id,
|
|
9
|
+
properties: JSON.stringify(props.properties, decycle()),
|
|
10
|
+
context: props.context
|
|
11
|
+
});
|
|
7
12
|
}
|
|
8
13
|
function OpenAPIRootSchema(props) {
|
|
9
|
-
return
|
|
14
|
+
return /* @__PURE__ */ jsx(OpenAPIRootSchemaFromServer, {
|
|
15
|
+
schema: JSON.stringify(props.schema, decycle()),
|
|
16
|
+
context: props.context
|
|
17
|
+
});
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
//#endregion
|
|
@@ -6,6 +6,7 @@ import { createStateKey, extractOperationSecurityInfo, resolveDescription } from
|
|
|
6
6
|
import { InteractiveSection } from "./InteractiveSection.js";
|
|
7
7
|
import { OpenAPIRequiredScopes, OpenAPISchemaScopes } from "./OpenAPIRequiredScopes.js";
|
|
8
8
|
import { Fragment } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
|
|
10
11
|
//#region src/OpenAPISecurities.tsx
|
|
11
12
|
/**
|
|
@@ -19,79 +20,146 @@ function OpenAPISecurities(props) {
|
|
|
19
20
|
securities
|
|
20
21
|
});
|
|
21
22
|
const stateKey = createStateKey("securities", context.blockKey);
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(OpenAPIRequiredScopes, {
|
|
24
|
+
context,
|
|
25
|
+
stateKey,
|
|
26
|
+
securities: tabsData
|
|
27
|
+
}), /* @__PURE__ */ jsx(InteractiveSection, {
|
|
28
|
+
header: t(context.translation, "authorizations"),
|
|
29
|
+
stateKey,
|
|
30
|
+
toggleIcon: context.icons.chevronRight,
|
|
31
|
+
selectIcon: context.icons.chevronDown,
|
|
32
|
+
className: "openapi-securities",
|
|
33
|
+
tabs: tabsData.map(({ key, label, schemes }) => ({
|
|
34
|
+
key,
|
|
35
|
+
label,
|
|
36
|
+
body: /* @__PURE__ */ jsx("div", {
|
|
37
|
+
className: "openapi-schema",
|
|
38
|
+
children: schemes.map((security, index) => {
|
|
39
|
+
const description = security.type !== "oauth2" ? resolveDescription(security) : void 0;
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
className: "openapi-schema-presentation",
|
|
42
|
+
children: [getLabelForType(security, context), description ? /* @__PURE__ */ jsx(Markdown, {
|
|
43
|
+
source: description,
|
|
44
|
+
className: "openapi-securities-description"
|
|
45
|
+
}) : null]
|
|
46
|
+
}, `${key}-${index}`);
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
}))
|
|
50
|
+
})] });
|
|
38
51
|
}
|
|
39
52
|
function getLabelForType(security, context) {
|
|
40
53
|
switch (security.type) {
|
|
41
|
-
case "apiKey": return
|
|
54
|
+
case "apiKey": return /* @__PURE__ */ jsx(OpenAPISchemaName, {
|
|
55
|
+
context,
|
|
56
|
+
propertyName: security.name ?? "apiKey",
|
|
57
|
+
type: "string",
|
|
58
|
+
required: security.required
|
|
59
|
+
});
|
|
42
60
|
case "http":
|
|
43
|
-
if (security.scheme === "basic") return
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
if (security.scheme === "basic") return /* @__PURE__ */ jsx(OpenAPISchemaName, {
|
|
62
|
+
context,
|
|
63
|
+
propertyName: "Authorization",
|
|
64
|
+
type: "string",
|
|
65
|
+
required: security.required
|
|
66
|
+
});
|
|
67
|
+
if (security.scheme === "bearer") return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(OpenAPISchemaName, {
|
|
68
|
+
context,
|
|
69
|
+
propertyName: "Authorization",
|
|
70
|
+
type: "string",
|
|
71
|
+
required: security.required
|
|
72
|
+
}), !security.description ? /* @__PURE__ */ jsx(Markdown, {
|
|
73
|
+
source: `Bearer authentication header of the form Bearer <token>.`,
|
|
74
|
+
className: "openapi-securities-description"
|
|
75
|
+
}) : null] });
|
|
76
|
+
return /* @__PURE__ */ jsx(OpenAPISchemaName, {
|
|
77
|
+
context,
|
|
78
|
+
propertyName: "HTTP",
|
|
79
|
+
required: security.required
|
|
80
|
+
});
|
|
81
|
+
case "oauth2": return /* @__PURE__ */ jsx(OpenAPISchemaOAuth2Flows, {
|
|
82
|
+
context,
|
|
83
|
+
security
|
|
84
|
+
});
|
|
85
|
+
case "openIdConnect": return /* @__PURE__ */ jsx(OpenAPISchemaName, {
|
|
86
|
+
context,
|
|
87
|
+
propertyName: "OpenID Connect",
|
|
88
|
+
required: security.required
|
|
89
|
+
});
|
|
52
90
|
default: return security.type;
|
|
53
91
|
}
|
|
54
92
|
}
|
|
55
93
|
function OpenAPISchemaOAuth2Flows(props) {
|
|
56
94
|
const { context, security } = props;
|
|
57
95
|
const flows = security.flows ? Object.entries(security.flows) : [];
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
96
|
+
return /* @__PURE__ */ jsx("div", {
|
|
97
|
+
className: "openapi-securities-oauth-flows",
|
|
98
|
+
children: flows.map(([name, flow], index) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(OpenAPISchemaOAuth2Item, {
|
|
99
|
+
flow,
|
|
100
|
+
name,
|
|
101
|
+
context,
|
|
102
|
+
security
|
|
103
|
+
}), index < flows.length - 1 ? /* @__PURE__ */ jsx("hr", {}) : null] }, index))
|
|
104
|
+
});
|
|
64
105
|
}
|
|
65
106
|
function OpenAPISchemaOAuth2Item(props) {
|
|
66
107
|
const { flow, context, security, name } = props;
|
|
67
108
|
if (!flow) return null;
|
|
68
109
|
const scopes = !security.scopes?.length && flow.scopes ? Object.entries(flow.scopes) : [];
|
|
69
110
|
const description = resolveDescription(security);
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
111
|
+
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(OpenAPISchemaName, {
|
|
112
|
+
context,
|
|
113
|
+
propertyName: "OAuth2",
|
|
114
|
+
type: name,
|
|
115
|
+
required: security.required
|
|
116
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
117
|
+
className: "openapi-securities-oauth-content openapi-markdown",
|
|
118
|
+
children: [
|
|
119
|
+
description ? /* @__PURE__ */ jsx(Markdown, {
|
|
120
|
+
source: description,
|
|
121
|
+
className: "openapi-securities-description"
|
|
122
|
+
}) : null,
|
|
123
|
+
"authorizationUrl" in flow && flow.authorizationUrl ? /* @__PURE__ */ jsxs("span", { children: [
|
|
124
|
+
"Authorization URL:",
|
|
125
|
+
" ",
|
|
126
|
+
/* @__PURE__ */ jsx(OpenAPICopyButton, {
|
|
127
|
+
value: flow.authorizationUrl,
|
|
128
|
+
context,
|
|
129
|
+
className: "openapi-securities-url",
|
|
130
|
+
withTooltip: true,
|
|
131
|
+
children: flow.authorizationUrl
|
|
132
|
+
})
|
|
133
|
+
] }) : null,
|
|
134
|
+
"tokenUrl" in flow && flow.tokenUrl ? /* @__PURE__ */ jsxs("span", { children: [
|
|
135
|
+
"Token URL:",
|
|
136
|
+
" ",
|
|
137
|
+
/* @__PURE__ */ jsx(OpenAPICopyButton, {
|
|
138
|
+
value: flow.tokenUrl,
|
|
139
|
+
context,
|
|
140
|
+
className: "openapi-securities-url",
|
|
141
|
+
withTooltip: true,
|
|
142
|
+
children: flow.tokenUrl
|
|
143
|
+
})
|
|
144
|
+
] }) : null,
|
|
145
|
+
"refreshUrl" in flow && flow.refreshUrl ? /* @__PURE__ */ jsxs("span", { children: [
|
|
146
|
+
"Refresh URL:",
|
|
147
|
+
" ",
|
|
148
|
+
/* @__PURE__ */ jsx(OpenAPICopyButton, {
|
|
149
|
+
value: flow.refreshUrl,
|
|
150
|
+
context,
|
|
151
|
+
className: "openapi-securities-url",
|
|
152
|
+
withTooltip: true,
|
|
153
|
+
children: flow.refreshUrl
|
|
154
|
+
})
|
|
155
|
+
] }) : null,
|
|
156
|
+
scopes.length ? /* @__PURE__ */ jsx(OpenAPISchemaScopes, {
|
|
157
|
+
scopes,
|
|
158
|
+
context,
|
|
159
|
+
isOAuth2: true
|
|
160
|
+
}) : null
|
|
161
|
+
]
|
|
162
|
+
})] });
|
|
95
163
|
}
|
|
96
164
|
|
|
97
165
|
//#endregion
|
package/dist/OpenAPISelect.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { getOrCreateStoreByKey } from "./getOrCreateStoreByKey.js";
|
|
5
5
|
import clsx from "classnames";
|
|
6
6
|
import { useCallback } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { Button, ListBox, ListBoxItem, Popover, Select, SelectValue } from "react-aria-components";
|
|
8
9
|
import { useStore } from "zustand";
|
|
9
10
|
|
|
@@ -19,26 +20,34 @@ function OpenAPISelect(props) {
|
|
|
19
20
|
const { icon, items, children, className, placement, stateKey, value, onChange, defaultValue } = props;
|
|
20
21
|
const state = useSelectState(stateKey, defaultValue ?? items[0]?.key);
|
|
21
22
|
const selected = items.find((item) => item.key === state.key) || items[0];
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
24
|
+
"aria-label": "OpenAPI Select",
|
|
25
|
+
...props,
|
|
26
|
+
value: value ?? selected?.key,
|
|
27
|
+
onChange: (key) => {
|
|
28
|
+
onChange?.(key);
|
|
29
|
+
state.setKey(key);
|
|
30
|
+
},
|
|
31
|
+
className: clsx("openapi-select", className),
|
|
32
|
+
children: [/* @__PURE__ */ jsxs(Button, { children: [/* @__PURE__ */ jsx(SelectValue, {}), icon !== null ? icon || "▼" : null] }), /* @__PURE__ */ jsx(Popover, {
|
|
33
|
+
placement,
|
|
34
|
+
className: "openapi-select-popover",
|
|
35
|
+
children: /* @__PURE__ */ jsx(ListBox, {
|
|
36
|
+
className: "openapi-select-listbox",
|
|
37
|
+
items,
|
|
38
|
+
children
|
|
39
|
+
})
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
36
42
|
}
|
|
37
43
|
function OpenAPISelectItem(props) {
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
"openapi-select-item
|
|
41
|
-
|
|
44
|
+
return /* @__PURE__ */ jsx(ListBoxItem, {
|
|
45
|
+
...props,
|
|
46
|
+
className: ({ isFocused, isSelected }) => clsx("openapi-select-item", {
|
|
47
|
+
"openapi-select-item-focused": isFocused,
|
|
48
|
+
"openapi-select-item-selected": isSelected
|
|
49
|
+
}, props.className)
|
|
50
|
+
});
|
|
42
51
|
}
|
|
43
52
|
|
|
44
53
|
//#endregion
|
package/dist/OpenAPISpec.js
CHANGED
|
@@ -5,6 +5,7 @@ import { StaticSection } from "./StaticSection.js";
|
|
|
5
5
|
import { OpenAPIRequestBody } from "./OpenAPIRequestBody.js";
|
|
6
6
|
import { OpenAPIResponses } from "./OpenAPIResponses.js";
|
|
7
7
|
import { OpenAPISecurities } from "./OpenAPISecurities.js";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
|
|
9
10
|
//#region src/OpenAPISpec.tsx
|
|
10
11
|
function OpenAPISpec(props) {
|
|
@@ -12,18 +13,32 @@ function OpenAPISpec(props) {
|
|
|
12
13
|
const { operation } = data;
|
|
13
14
|
const parameterGroups = groupParameters(deduplicateParameters(operation.parameters ?? []), context);
|
|
14
15
|
const securities = "securities" in data ? data.securities : [];
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
+
securities.length > 0 ? /* @__PURE__ */ jsx(OpenAPISecurities, {
|
|
18
|
+
securityRequirement: operation.security,
|
|
19
|
+
securities,
|
|
20
|
+
context
|
|
21
|
+
}, "securities") : null,
|
|
22
|
+
parameterGroups.map((group) => {
|
|
23
|
+
return /* @__PURE__ */ jsx(StaticSection, {
|
|
24
|
+
className: "openapi-parameters",
|
|
25
|
+
header: group.label,
|
|
26
|
+
children: /* @__PURE__ */ jsx(OpenAPISchemaProperties, {
|
|
27
|
+
properties: group.parameters.map(parameterToProperty),
|
|
28
|
+
context
|
|
29
|
+
})
|
|
30
|
+
}, `parameter-${group.key}`);
|
|
31
|
+
}),
|
|
32
|
+
operation.requestBody ? /* @__PURE__ */ jsx(OpenAPIRequestBody, {
|
|
33
|
+
requestBody: operation.requestBody,
|
|
34
|
+
context,
|
|
35
|
+
data
|
|
36
|
+
}, "body") : null,
|
|
37
|
+
operation.responses ? /* @__PURE__ */ jsx(OpenAPIResponses, {
|
|
38
|
+
responses: operation.responses,
|
|
39
|
+
context
|
|
40
|
+
}, "responses") : null
|
|
41
|
+
] });
|
|
27
42
|
}
|
|
28
43
|
function groupParameters(parameters, context) {
|
|
29
44
|
const sorted = [
|
package/dist/OpenAPITooltip.js
CHANGED
|
@@ -2,20 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import clsx from "classnames";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
import { Tooltip, TooltipTrigger } from "react-aria-components";
|
|
6
7
|
|
|
7
8
|
//#region src/OpenAPITooltip.tsx
|
|
8
9
|
function OpenAPITooltip(props) {
|
|
9
10
|
const { children,...rest } = props;
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
return /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
12
|
+
...rest,
|
|
13
|
+
closeDelay: 200,
|
|
14
|
+
delay: 200,
|
|
15
|
+
children
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
function OpenAPITooltipContent(props) {
|
|
15
19
|
const { children, placement = "top", offset = 4, className,...rest } = props;
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
21
|
+
...rest,
|
|
22
|
+
placement,
|
|
23
|
+
offset,
|
|
24
|
+
className: clsx("openapi-tooltip", className),
|
|
25
|
+
children
|
|
26
|
+
});
|
|
19
27
|
}
|
|
20
28
|
OpenAPITooltip.Content = OpenAPITooltipContent;
|
|
21
29
|
|
package/dist/OpenAPIWebhook.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OpenAPIContextInput } from "./context.js";
|
|
2
2
|
import { OpenAPIWebhookData } from "./types.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/OpenAPIWebhook.d.ts
|
|
6
6
|
/**
|
|
@@ -10,6 +10,6 @@ declare function OpenAPIWebhook(props: {
|
|
|
10
10
|
className?: string;
|
|
11
11
|
data: OpenAPIWebhookData;
|
|
12
12
|
context: OpenAPIContextInput;
|
|
13
|
-
}):
|
|
13
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { OpenAPIWebhook };
|
package/dist/OpenAPIWebhook.js
CHANGED
|
@@ -3,6 +3,7 @@ import { OpenAPIColumnSpec } from "./common/OpenAPIColumnSpec.js";
|
|
|
3
3
|
import { OpenAPISummary } from "./common/OpenAPISummary.js";
|
|
4
4
|
import { OpenAPIWebhookExample } from "./OpenAPIWebhookExample.js";
|
|
5
5
|
import clsx from "classnames";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
|
|
7
8
|
//#region src/OpenAPIWebhook.tsx
|
|
8
9
|
/**
|
|
@@ -11,17 +12,28 @@ import clsx from "classnames";
|
|
|
11
12
|
function OpenAPIWebhook(props) {
|
|
12
13
|
const { className, data, context: contextInput } = props;
|
|
13
14
|
const context = resolveOpenAPIContext(contextInput);
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
+
className: clsx("openapi-webhook", className),
|
|
17
|
+
children: [/* @__PURE__ */ jsx(OpenAPISummary, {
|
|
18
|
+
data,
|
|
19
|
+
context
|
|
20
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: "openapi-columns",
|
|
22
|
+
children: [/* @__PURE__ */ jsx(OpenAPIColumnSpec, {
|
|
23
|
+
data,
|
|
24
|
+
context
|
|
25
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
26
|
+
className: "openapi-column-preview",
|
|
27
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: "openapi-column-preview-body",
|
|
29
|
+
children: /* @__PURE__ */ jsx(OpenAPIWebhookExample, {
|
|
30
|
+
data,
|
|
31
|
+
context
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
})]
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
25
37
|
}
|
|
26
38
|
|
|
27
39
|
//#endregion
|
|
@@ -3,6 +3,7 @@ import { createStateKey } from "./utils.js";
|
|
|
3
3
|
import { getOpenAPIClientContext } from "./context.js";
|
|
4
4
|
import { getExamples } from "./util/example.js";
|
|
5
5
|
import { OpenAPIMediaTypeContent } from "./OpenAPIMediaType.js";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
|
|
7
8
|
//#region src/OpenAPIWebhookExample.tsx
|
|
8
9
|
function OpenAPIWebhookExample(props) {
|
|
@@ -14,12 +15,12 @@ function OpenAPIWebhookExample(props) {
|
|
|
14
15
|
if (!value?.schema) return {
|
|
15
16
|
key,
|
|
16
17
|
label: key,
|
|
17
|
-
body:
|
|
18
|
+
body: /* @__PURE__ */ jsx(OpenAPIEmptyExample, { context })
|
|
18
19
|
};
|
|
19
20
|
return {
|
|
20
21
|
key,
|
|
21
22
|
label: key,
|
|
22
|
-
body:
|
|
23
|
+
body: /* @__PURE__ */ jsx(Fragment, {}),
|
|
23
24
|
examples: getExamples({
|
|
24
25
|
mediaTypeObject: value,
|
|
25
26
|
mediaType: key,
|
|
@@ -28,12 +29,21 @@ function OpenAPIWebhookExample(props) {
|
|
|
28
29
|
};
|
|
29
30
|
});
|
|
30
31
|
})();
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
33
|
+
className: "openapi-panel",
|
|
34
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
35
|
+
className: "openapi-panel-heading",
|
|
36
|
+
children: "Payload"
|
|
37
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
38
|
+
className: "openapi-panel-body",
|
|
39
|
+
children: /* @__PURE__ */ jsx(OpenAPIMediaTypeContent, {
|
|
40
|
+
selectIcon: context.icons.chevronDown,
|
|
41
|
+
stateKey: createStateKey("request-body-media-type", context.blockKey),
|
|
42
|
+
items,
|
|
43
|
+
context: getOpenAPIClientContext(context)
|
|
44
|
+
})
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
//#endregion
|