@gitbook/react-openapi 1.5.4 → 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.
Files changed (50) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/InteractiveSection.js +52 -30
  3. package/dist/Markdown.js +5 -1
  4. package/dist/OpenAPICodeSample.js +45 -9
  5. package/dist/OpenAPICodeSampleInteractive.js +41 -15
  6. package/dist/OpenAPICodeSampleSelector.js +34 -14
  7. package/dist/OpenAPICopyButton.js +21 -15
  8. package/dist/OpenAPIDisclosure.js +18 -10
  9. package/dist/OpenAPIDisclosureGroup.js +56 -30
  10. package/dist/OpenAPIExample.js +6 -4
  11. package/dist/OpenAPIMediaType.js +38 -17
  12. package/dist/OpenAPIOperation.d.ts +2 -2
  13. package/dist/OpenAPIOperation.js +26 -12
  14. package/dist/OpenAPIOperationContext.d.ts +2 -2
  15. package/dist/OpenAPIOperationContext.js +5 -3
  16. package/dist/OpenAPIPath.js +14 -5
  17. package/dist/OpenAPIPathItem.js +26 -12
  18. package/dist/OpenAPIPathMultipleServers.js +29 -12
  19. package/dist/OpenAPIPrefillContextProvider.d.ts +2 -1
  20. package/dist/OpenAPIPrefillContextProvider.js +5 -3
  21. package/dist/OpenAPIRequestBody.js +20 -10
  22. package/dist/OpenAPIRequestBodyHeaderType.js +5 -3
  23. package/dist/OpenAPIRequiredScopes.js +41 -26
  24. package/dist/OpenAPIResponse.js +34 -19
  25. package/dist/OpenAPIResponseExample.js +25 -8
  26. package/dist/OpenAPIResponseExampleContent.js +39 -18
  27. package/dist/OpenAPIResponses.js +40 -17
  28. package/dist/OpenAPISchema.js +212 -88
  29. package/dist/OpenAPISchemaName.js +44 -24
  30. package/dist/OpenAPISchemaServer.js +10 -2
  31. package/dist/OpenAPISecurities.js +125 -57
  32. package/dist/OpenAPISelect.js +27 -18
  33. package/dist/OpenAPISpec.js +27 -12
  34. package/dist/OpenAPITooltip.js +14 -6
  35. package/dist/OpenAPIWebhook.d.ts +2 -2
  36. package/dist/OpenAPIWebhook.js +23 -11
  37. package/dist/OpenAPIWebhookExample.js +18 -8
  38. package/dist/ScalarApiButton.js +50 -29
  39. package/dist/StaticSection.js +49 -15
  40. package/dist/common/OpenAPIColumnSpec.js +21 -9
  41. package/dist/common/OpenAPIOperationDescription.js +12 -6
  42. package/dist/common/OpenAPIStability.js +6 -3
  43. package/dist/common/OpenAPISummary.js +23 -12
  44. package/dist/formatPath.js +7 -4
  45. package/dist/schemas/OpenAPISchemaItem.js +18 -11
  46. package/dist/schemas/OpenAPISchemas.d.ts +2 -2
  47. package/dist/schemas/OpenAPISchemas.js +55 -31
  48. package/dist/translate.js +4 -6
  49. package/dist/util/example.js +6 -1
  50. package/package.json +3 -3
@@ -4,6 +4,7 @@
4
4
  import { OpenAPIEmptyExample } from "./OpenAPIExample.js";
5
5
  import { StaticSection } from "./StaticSection.js";
6
6
  import { OpenAPISelect, OpenAPISelectItem, useSelectState } from "./OpenAPISelect.js";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
8
 
8
9
  //#region src/OpenAPIMediaType.tsx
9
10
  /**
@@ -20,25 +21,45 @@ function OpenAPIMediaTypeContent(props) {
20
21
  const state = useMediaTypesState(stateKey, items[0]?.key);
21
22
  const examples = items.find((item) => item.key === state.key)?.examples ?? [];
22
23
  if (!items.length && !examples.length) return null;
23
- return <StaticSection footer={items.length > 1 || examples.length > 1 ? <OpenAPIMediaTypeFooter items={items} examples={examples} selectIcon={selectIcon} stateKey={stateKey} /> : null} className="openapi-response-media-types-examples">
24
- <OpenAPIMediaTypeBody context={context} stateKey={stateKey} items={items} examples={examples} />
25
- </StaticSection>;
24
+ return /* @__PURE__ */ jsx(StaticSection, {
25
+ footer: items.length > 1 || examples.length > 1 ? /* @__PURE__ */ jsx(OpenAPIMediaTypeFooter, {
26
+ items,
27
+ examples,
28
+ selectIcon,
29
+ stateKey
30
+ }) : null,
31
+ className: "openapi-response-media-types-examples",
32
+ children: /* @__PURE__ */ jsx(OpenAPIMediaTypeBody, {
33
+ context,
34
+ stateKey,
35
+ items,
36
+ examples
37
+ })
38
+ });
26
39
  }
27
40
  function OpenAPIMediaTypeFooter(props) {
28
41
  const { items, examples, stateKey, selectIcon } = props;
29
- return <>
30
- {items.length > 1 && <OpenAPISelect icon={selectIcon} items={items} stateKey={stateKey} placement="bottom start">
31
- {items.map((item) => <OpenAPISelectItem key={item.key} id={item.key} value={item}>
32
- <span>{item.label}</span>
33
- </OpenAPISelectItem>)}
34
- </OpenAPISelect>}
35
-
36
- {examples && examples.length > 1 ? <OpenAPISelect icon={selectIcon} items={examples} stateKey={`${stateKey}-examples`} placement="bottom start">
37
- {examples.map((example) => <OpenAPISelectItem key={example.key} id={example.key} value={example}>
38
- <span>{example.label}</span>
39
- </OpenAPISelectItem>)}
40
- </OpenAPISelect> : null}
41
- </>;
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [items.length > 1 && /* @__PURE__ */ jsx(OpenAPISelect, {
43
+ icon: selectIcon,
44
+ items,
45
+ stateKey,
46
+ placement: "bottom start",
47
+ children: items.map((item) => /* @__PURE__ */ jsx(OpenAPISelectItem, {
48
+ id: item.key,
49
+ value: item,
50
+ children: /* @__PURE__ */ jsx("span", { children: item.label })
51
+ }, item.key))
52
+ }), examples && examples.length > 1 ? /* @__PURE__ */ jsx(OpenAPISelect, {
53
+ icon: selectIcon,
54
+ items: examples,
55
+ stateKey: `${stateKey}-examples`,
56
+ placement: "bottom start",
57
+ children: examples.map((example) => /* @__PURE__ */ jsx(OpenAPISelectItem, {
58
+ id: example.key,
59
+ value: example,
60
+ children: /* @__PURE__ */ jsx("span", { children: example.label })
61
+ }, example.key))
62
+ }) : null] });
42
63
  }
43
64
  function OpenAPIMediaTypeBody(props) {
44
65
  const { stateKey, items, examples, context } = props;
@@ -48,7 +69,7 @@ function OpenAPIMediaTypeBody(props) {
48
69
  if (!selectedItem) return null;
49
70
  if (examples) {
50
71
  const selectedExample = examples.find((example) => example.key === exampleState.key) ?? examples[0];
51
- if (!selectedExample) return <OpenAPIEmptyExample context={context} />;
72
+ if (!selectedExample) return /* @__PURE__ */ jsx(OpenAPIEmptyExample, { context });
52
73
  return selectedExample.body;
53
74
  }
54
75
  return selectedItem.body;
@@ -1,6 +1,6 @@
1
1
  import { OpenAPIContextInput } from "./context.js";
2
2
  import { OpenAPIOperationData } from "./types.js";
3
- import * as react0 from "react";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/OpenAPIOperation.d.ts
6
6
  /**
@@ -10,6 +10,6 @@ declare function OpenAPIOperation(props: {
10
10
  className?: string;
11
11
  data: OpenAPIOperationData;
12
12
  context: OpenAPIContextInput;
13
- }): react0.JSX.Element;
13
+ }): react_jsx_runtime0.JSX.Element;
14
14
  //#endregion
15
15
  export { OpenAPIOperation };
@@ -4,6 +4,7 @@ import { OpenAPIResponseExample } from "./OpenAPIResponseExample.js";
4
4
  import { OpenAPIColumnSpec } from "./common/OpenAPIColumnSpec.js";
5
5
  import { OpenAPISummary } from "./common/OpenAPISummary.js";
6
6
  import clsx from "classnames";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
7
8
 
8
9
  //#region src/OpenAPIOperation.tsx
9
10
  /**
@@ -12,18 +13,31 @@ import clsx from "classnames";
12
13
  function OpenAPIOperation(props) {
13
14
  const { className, data, context: contextInput } = props;
14
15
  const context = resolveOpenAPIContext(contextInput);
15
- return <div className={clsx("openapi-operation", className)}>
16
- <OpenAPISummary data={data} context={context} />
17
- <div className="openapi-columns">
18
- <OpenAPIColumnSpec data={data} context={context} />
19
- <div className="openapi-column-preview">
20
- <div className="openapi-column-preview-body">
21
- <OpenAPICodeSample data={data} context={context} />
22
- <OpenAPIResponseExample data={data} context={context} />
23
- </div>
24
- </div>
25
- </div>
26
- </div>;
16
+ return /* @__PURE__ */ jsxs("div", {
17
+ className: clsx("openapi-operation", className),
18
+ children: [/* @__PURE__ */ jsx(OpenAPISummary, {
19
+ data,
20
+ context
21
+ }), /* @__PURE__ */ jsxs("div", {
22
+ className: "openapi-columns",
23
+ children: [/* @__PURE__ */ jsx(OpenAPIColumnSpec, {
24
+ data,
25
+ context
26
+ }), /* @__PURE__ */ jsx("div", {
27
+ className: "openapi-column-preview",
28
+ children: /* @__PURE__ */ jsxs("div", {
29
+ className: "openapi-column-preview-body",
30
+ children: [/* @__PURE__ */ jsx(OpenAPICodeSample, {
31
+ data,
32
+ context
33
+ }), /* @__PURE__ */ jsx(OpenAPIResponseExample, {
34
+ data,
35
+ context
36
+ })]
37
+ })
38
+ })]
39
+ })]
40
+ });
27
41
  }
28
42
 
29
43
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react1 from "react";
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/OpenAPIOperationContext.d.ts
4
4
  interface OpenAPIOperationPointer {
@@ -11,7 +11,7 @@ interface OpenAPIOperationContextValue {
11
11
  /**
12
12
  * Provider for the OpenAPIOperationContext.
13
13
  */
14
- declare function OpenAPIOperationContextProvider(props: React.PropsWithChildren<Partial<OpenAPIOperationContextValue>>): react1.JSX.Element;
14
+ declare function OpenAPIOperationContextProvider(props: React.PropsWithChildren<Partial<OpenAPIOperationContextValue>>): react_jsx_runtime1.JSX.Element;
15
15
  /**
16
16
  * Hook to access the OpenAPIOperationContext.
17
17
  */
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
  import { createContext, useContext, useMemo } from "react";
5
+ import { jsx } from "react/jsx-runtime";
5
6
  import { useEventCallback } from "usehooks-ts";
6
7
 
7
8
  //#region src/OpenAPIOperationContext.tsx
@@ -15,9 +16,10 @@ function OpenAPIOperationContextProvider(props) {
15
16
  props.onOpenClient?.(pointer);
16
17
  });
17
18
  const value = useMemo(() => ({ onOpenClient }), [onOpenClient]);
18
- return <OpenAPIOperationContext.Provider value={value}>
19
- {children}
20
- </OpenAPIOperationContext.Provider>;
19
+ return /* @__PURE__ */ jsx(OpenAPIOperationContext.Provider, {
20
+ value,
21
+ children
22
+ });
21
23
  }
22
24
  /**
23
25
  * Hook to access the OpenAPIOperationContext.
@@ -3,6 +3,7 @@ import { OpenAPIPathItem } from "./OpenAPIPathItem.js";
3
3
  import { formatPath } from "./formatPath.js";
4
4
  import { getDefaultServerURL } from "./util/server.js";
5
5
  import { OpenAPIPathMultipleServers } from "./OpenAPIPathMultipleServers.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
6
7
 
7
8
  //#region src/OpenAPIPath.tsx
8
9
  /**
@@ -12,13 +13,21 @@ function OpenAPIPath(props) {
12
13
  const { data, withServer = true, context } = props;
13
14
  const { path } = data;
14
15
  const clientContext = getOpenAPIClientContext(context);
15
- if (withServer && data.servers.length > 1) return <OpenAPIPathMultipleServers {...props} context={clientContext} />;
16
+ if (withServer && data.servers.length > 1) return /* @__PURE__ */ jsx(OpenAPIPathMultipleServers, {
17
+ ...props,
18
+ context: clientContext
19
+ });
16
20
  const formattedPath = formatPath(path);
17
21
  const defaultServer = getDefaultServerURL(data.servers);
18
- return <OpenAPIPathItem {...props} value={`${defaultServer}${path}`} context={clientContext}>
19
- {withServer ? <span className="openapi-path-server">{defaultServer}</span> : null}
20
- {formattedPath}
21
- </OpenAPIPathItem>;
22
+ return /* @__PURE__ */ jsxs(OpenAPIPathItem, {
23
+ ...props,
24
+ value: `${defaultServer}${path}`,
25
+ context: clientContext,
26
+ children: [withServer ? /* @__PURE__ */ jsx("span", {
27
+ className: "openapi-path-server",
28
+ children: defaultServer
29
+ }) : null, formattedPath]
30
+ });
22
31
  }
23
32
 
24
33
  //#endregion
@@ -1,21 +1,35 @@
1
1
  import { OpenAPICopyButton } from "./OpenAPICopyButton.js";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
 
3
4
  //#region src/OpenAPIPathItem.tsx
4
5
  function OpenAPIPathItem(props) {
5
6
  const { value, canCopy = true, context, children, data, copyType = "children" } = props;
6
7
  const { operation, method } = data;
7
- const title = <span className="openapi-path-title">{children}</span>;
8
- return <div className="openapi-path">
9
- <div className={`openapi-method openapi-method-${method}`}>{method}</div>
10
- {canCopy && value ? copyType === "children" ? <OpenAPICopyButton value={value} data-deprecated={operation.deprecated} isDisabled={!canCopy} context={context} className="openapi-path-copy-button">
11
- {title}
12
- </OpenAPICopyButton> : <>
13
- {title}
14
- <OpenAPICopyButton value={value} data-deprecated={operation.deprecated} isDisabled={!canCopy} context={context} className="openapi-path-copy-button openapi-path-copy-button-icon">
15
- {context.icons.copy}
16
- </OpenAPICopyButton>
17
- </> : title}
18
- </div>;
8
+ const title = /* @__PURE__ */ jsx("span", {
9
+ className: "openapi-path-title",
10
+ children
11
+ });
12
+ return /* @__PURE__ */ jsxs("div", {
13
+ className: "openapi-path",
14
+ children: [/* @__PURE__ */ jsx("div", {
15
+ className: `openapi-method openapi-method-${method}`,
16
+ children: method
17
+ }), canCopy && value ? copyType === "children" ? /* @__PURE__ */ jsx(OpenAPICopyButton, {
18
+ value,
19
+ "data-deprecated": operation.deprecated,
20
+ isDisabled: !canCopy,
21
+ context,
22
+ className: "openapi-path-copy-button",
23
+ children: title
24
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [title, /* @__PURE__ */ jsx(OpenAPICopyButton, {
25
+ value,
26
+ "data-deprecated": operation.deprecated,
27
+ isDisabled: !canCopy,
28
+ context,
29
+ className: "openapi-path-copy-button openapi-path-copy-button-icon",
30
+ children: context.icons.copy
31
+ })] }) : title]
32
+ });
19
33
  }
20
34
 
21
35
  //#endregion
@@ -7,6 +7,7 @@ import { OpenAPISelect, OpenAPISelectItem, useSelectState } from "./OpenAPISelec
7
7
  import { OpenAPIPathItem } from "./OpenAPIPathItem.js";
8
8
  import { formatPath } from "./formatPath.js";
9
9
  import { getDefaultServerURL } from "./util/server.js";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
10
11
  import { Text } from "react-aria-components";
11
12
 
12
13
  //#region src/OpenAPIPathMultipleServers.tsx
@@ -25,18 +26,34 @@ function OpenAPIPathMultipleServers(props) {
25
26
  label: server.url,
26
27
  description: server.description
27
28
  }));
28
- return <OpenAPIPathItem copyType="button" {...props} value={`${withServer ? key : ""}${path}`} context={context}>
29
- {withServer ? <OpenAPITooltip>
30
- <OpenAPISelect className="openapi-select openapi-select-unstyled" items={items} stateKey={serversStateKey} placement="bottom start" icon={context.icons.chevronDown} defaultValue={defaultServer} onChange={setKey}>
31
- {items.map((item) => <OpenAPISelectItem textValue={item.label} key={item.key} id={item.key} value={item} className="openapi-select-item-column">
32
- <Text slot="label">{item.label}</Text>
33
- {item.description ? <Text slot="description">{item.description}</Text> : null}
34
- </OpenAPISelectItem>)}
35
- </OpenAPISelect>
36
- <OpenAPITooltip.Content>Click to select a server</OpenAPITooltip.Content>
37
- </OpenAPITooltip> : null}
38
- {formattedPath}
39
- </OpenAPIPathItem>;
29
+ return /* @__PURE__ */ jsxs(OpenAPIPathItem, {
30
+ copyType: "button",
31
+ ...props,
32
+ value: `${withServer ? key : ""}${path}`,
33
+ context,
34
+ children: [withServer ? /* @__PURE__ */ jsxs(OpenAPITooltip, { children: [/* @__PURE__ */ jsx(OpenAPISelect, {
35
+ className: "openapi-select openapi-select-unstyled",
36
+ items,
37
+ stateKey: serversStateKey,
38
+ placement: "bottom start",
39
+ icon: context.icons.chevronDown,
40
+ defaultValue: defaultServer,
41
+ onChange: setKey,
42
+ children: items.map((item) => /* @__PURE__ */ jsxs(OpenAPISelectItem, {
43
+ textValue: item.label,
44
+ id: item.key,
45
+ value: item,
46
+ className: "openapi-select-item-column",
47
+ children: [/* @__PURE__ */ jsx(Text, {
48
+ slot: "label",
49
+ children: item.label
50
+ }), item.description ? /* @__PURE__ */ jsx(Text, {
51
+ slot: "description",
52
+ children: item.description
53
+ }) : null]
54
+ }, item.key))
55
+ }), /* @__PURE__ */ jsx(OpenAPITooltip.Content, { children: "Click to select a server" })] }) : null, formattedPath]
56
+ });
40
57
  }
41
58
 
42
59
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import * as React$1 from "react";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
2
3
 
3
4
  //#region src/OpenAPIPrefillContextProvider.d.ts
4
5
 
@@ -17,7 +18,7 @@ type PrefillContextValue = () => PrefillInputContextData | null;
17
18
  */
18
19
  declare function OpenAPIPrefillContextProvider(props: React$1.PropsWithChildren<{
19
20
  getPrefillInputContextData: () => PrefillInputContextData | null;
20
- }>): React$1.JSX.Element;
21
+ }>): react_jsx_runtime2.JSX.Element;
21
22
  /**
22
23
  * Hook to access the prefill context function.
23
24
  */
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
  import * as React$1 from "react";
5
+ import { jsx } from "react/jsx-runtime";
5
6
 
6
7
  //#region src/OpenAPIPrefillContextProvider.tsx
7
8
  const OpenAPIPrefillContext = React$1.createContext(null);
@@ -10,9 +11,10 @@ const OpenAPIPrefillContext = React$1.createContext(null);
10
11
  */
11
12
  function OpenAPIPrefillContextProvider(props) {
12
13
  const { getPrefillInputContextData, children } = props;
13
- return <OpenAPIPrefillContext.Provider value={getPrefillInputContextData}>
14
- {children}
15
- </OpenAPIPrefillContext.Provider>;
14
+ return /* @__PURE__ */ jsx(OpenAPIPrefillContext.Provider, {
15
+ value: getPrefillInputContextData,
16
+ children
17
+ });
16
18
  }
17
19
  /**
18
20
  * Hook to access the prefill context function.
@@ -3,6 +3,7 @@ import { checkIsReference, createStateKey } from "./utils.js";
3
3
  import { OpenAPIRootSchema } from "./OpenAPISchemaServer.js";
4
4
  import { InteractiveSection } from "./InteractiveSection.js";
5
5
  import { OpenAPIRequestBodyHeaderType } from "./OpenAPIRequestBodyHeaderType.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
7
 
7
8
  //#region src/OpenAPIRequestBody.tsx
8
9
  /**
@@ -12,16 +13,25 @@ function OpenAPIRequestBody(props) {
12
13
  const { requestBody, context, data } = props;
13
14
  if (checkIsReference(requestBody)) return null;
14
15
  const stateKey = createStateKey("request-body-media-type", context.blockKey);
15
- return <InteractiveSection header={<>
16
- <span>{t(context.translation, "name" in data ? "payload" : "body")}</span>
17
- <OpenAPIRequestBodyHeaderType requestBody={requestBody} stateKey={stateKey} />
18
- </>} className="openapi-requestbody" stateKey={stateKey} selectIcon={context.icons.chevronDown} tabs={Object.entries(requestBody.content ?? {}).map(([contentType, mediaTypeObject]) => {
19
- return {
20
- key: contentType,
21
- label: contentType,
22
- body: <OpenAPIRootSchema schema={mediaTypeObject.schema ?? {}} context={context} key={contentType} />
23
- };
24
- })} />;
16
+ return /* @__PURE__ */ jsx(InteractiveSection, {
17
+ header: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { children: t(context.translation, "name" in data ? "payload" : "body") }), /* @__PURE__ */ jsx(OpenAPIRequestBodyHeaderType, {
18
+ requestBody,
19
+ stateKey
20
+ })] }),
21
+ className: "openapi-requestbody",
22
+ stateKey,
23
+ selectIcon: context.icons.chevronDown,
24
+ tabs: Object.entries(requestBody.content ?? {}).map(([contentType, mediaTypeObject]) => {
25
+ return {
26
+ key: contentType,
27
+ label: contentType,
28
+ body: /* @__PURE__ */ jsx(OpenAPIRootSchema, {
29
+ schema: mediaTypeObject.schema ?? {},
30
+ context
31
+ }, contentType)
32
+ };
33
+ })
34
+ });
25
35
  }
26
36
 
27
37
  //#endregion
@@ -3,6 +3,7 @@
3
3
 
4
4
  import { getSchemaTitle } from "./utils.js";
5
5
  import { useSelectState } from "./OpenAPISelect.js";
6
+ import { jsx } from "react/jsx-runtime";
6
7
 
7
8
  //#region src/OpenAPIRequestBodyHeaderType.tsx
8
9
  /**
@@ -14,9 +15,10 @@ function OpenAPIRequestBodyHeaderType(props) {
14
15
  const state = useSelectState(stateKey, Object.keys(content)[0]);
15
16
  const selectedContentMediaType = Object.entries(content).find(([contentType]) => contentType === state.key)?.[1];
16
17
  if (!selectedContentMediaType || !selectedContentMediaType.schema?.type || selectedContentMediaType.schema.type !== "array") return null;
17
- return <span className="openapi-requestbody-header-type">
18
- {`${getSchemaTitle(selectedContentMediaType.schema)}`}
19
- </span>;
18
+ return /* @__PURE__ */ jsx("span", {
19
+ className: "openapi-requestbody-header-type",
20
+ children: `${getSchemaTitle(selectedContentMediaType.schema)}`
21
+ });
20
22
  }
21
23
 
22
24
  //#endregion
@@ -5,6 +5,7 @@ import { t } from "./translate.js";
5
5
  import { OpenAPICopyButton } from "./OpenAPICopyButton.js";
6
6
  import { useSelectState } from "./OpenAPISelect.js";
7
7
  import { OpenAPIDisclosureGroup } from "./OpenAPIDisclosureGroup.js";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
8
9
 
9
10
  //#region src/OpenAPIRequiredScopes.tsx
10
11
  /**
@@ -19,48 +20,62 @@ function OpenAPIRequiredScopes(props) {
19
20
  return scheme.scopes ?? [];
20
21
  });
21
22
  if (!scopes.length) return null;
22
- return <OpenAPIDisclosureGroup className="openapi-required-scopes" icon={context.icons.chevronRight} stateKey="required-scopes" defaultExpandedKeys={["required-scopes"]} groups={[{
23
- key: "required-scopes",
24
- label: <div className="openapi-required-scopes-header">
25
- {context.icons.lock}
26
- <span>{t(context.translation, "required_scopes")}</span>
27
- </div>,
28
- tabs: [{
29
- key: "scopes",
30
- label: "",
31
- body: <OpenAPISchemaScopes scopes={scopes} context={context} />
23
+ return /* @__PURE__ */ jsx(OpenAPIDisclosureGroup, {
24
+ className: "openapi-required-scopes",
25
+ icon: context.icons.chevronRight,
26
+ stateKey: "required-scopes",
27
+ defaultExpandedKeys: ["required-scopes"],
28
+ groups: [{
29
+ key: "required-scopes",
30
+ label: /* @__PURE__ */ jsxs("div", {
31
+ className: "openapi-required-scopes-header",
32
+ children: [context.icons.lock, /* @__PURE__ */ jsx("span", { children: t(context.translation, "required_scopes") })]
33
+ }),
34
+ tabs: [{
35
+ key: "scopes",
36
+ label: "",
37
+ body: /* @__PURE__ */ jsx(OpenAPISchemaScopes, {
38
+ scopes,
39
+ context
40
+ })
41
+ }]
32
42
  }]
33
- }]} />;
43
+ });
34
44
  }
35
45
  function OpenAPISchemaScopes(props) {
36
46
  const { scopes, context, isOAuth2 } = props;
37
- return <div className="openapi-securities-scopes openapi-markdown">
38
- <div className="openapi-required-scopes-description">
39
- {t(context.translation, isOAuth2 ? "available_scopes" : "required_scopes_description")}
40
- </div>
41
- <ul>
42
- {scopes.map((scope) => <OpenAPIScopeItem key={scope[0]} scope={scope} context={context} />)}
43
- </ul>
44
- </div>;
47
+ return /* @__PURE__ */ jsxs("div", {
48
+ className: "openapi-securities-scopes openapi-markdown",
49
+ children: [/* @__PURE__ */ jsx("div", {
50
+ className: "openapi-required-scopes-description",
51
+ children: t(context.translation, isOAuth2 ? "available_scopes" : "required_scopes_description")
52
+ }), /* @__PURE__ */ jsx("ul", { children: scopes.map((scope) => /* @__PURE__ */ jsx(OpenAPIScopeItem, {
53
+ scope,
54
+ context
55
+ }, scope[0])) })]
56
+ });
45
57
  }
46
58
  /**
47
59
  * Display a scope item. Either a key-value pair or a single string.
48
60
  */
49
61
  function OpenAPIScopeItem(props) {
50
62
  const { scope, context } = props;
51
- return <li>
52
- <OpenAPIScopeItemKey name={scope[0]} context={context} />
53
- {scope[1] ? <span>: {scope[1]}</span> : null}
54
- </li>;
63
+ return /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx(OpenAPIScopeItemKey, {
64
+ name: scope[0],
65
+ context
66
+ }), scope[1] ? /* @__PURE__ */ jsxs("span", { children: [": ", scope[1]] }) : null] });
55
67
  }
56
68
  /**
57
69
  * Displays the scope name within a copyable button.
58
70
  */
59
71
  function OpenAPIScopeItemKey(props) {
60
72
  const { name, context } = props;
61
- return <OpenAPICopyButton value={name} context={context} withTooltip>
62
- <code>{name}</code>
63
- </OpenAPICopyButton>;
73
+ return /* @__PURE__ */ jsx(OpenAPICopyButton, {
74
+ value: name,
75
+ context,
76
+ withTooltip: true,
77
+ children: /* @__PURE__ */ jsx("code", { children: name })
78
+ });
64
79
  }
65
80
 
66
81
  //#endregion
@@ -3,6 +3,7 @@ import { OpenAPIDisclosure } from "./OpenAPIDisclosure.js";
3
3
  import { parameterToProperty, resolveDescription } from "./utils.js";
4
4
  import { OpenAPISchemaPresentation } from "./OpenAPISchema.js";
5
5
  import { OpenAPISchemaProperties } from "./OpenAPISchemaServer.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
6
7
 
7
8
  //#region src/OpenAPIResponse.tsx
8
9
  /**
@@ -14,25 +15,39 @@ function OpenAPIResponse(props) {
14
15
  const content = Object.entries(mediaType?.schema ?? {});
15
16
  const description = resolveDescription(response);
16
17
  if (content.length === 0 && !description && headers.length === 0) return null;
17
- return <div className="openapi-response-body">
18
- {headers.length > 0 ? <OpenAPIDisclosure header={<OpenAPISchemaPresentation context={context} property={{
19
- propertyName: tString(context.translation, "headers"),
20
- schema: { type: "object" },
21
- required: null
22
- }} />} icon={context.icons.plus} label={(isExpanded) => tString(context.translation, isExpanded ? "hide" : "show", tString(context.translation, headers.length === 1 ? "header" : "headers"))}>
23
- <OpenAPISchemaProperties properties={headers.map(([name, header]) => parameterToProperty({
24
- name,
25
- ...header
26
- }))} context={context} />
27
- </OpenAPIDisclosure> : null}
28
- {mediaType?.schema && <div className="openapi-responsebody">
29
- <OpenAPISchemaProperties id={`response-${context.blockKey}`} properties={[{
30
- schema: mediaType.schema,
31
- propertyName: tString(context.translation, "response"),
32
- required: null
33
- }]} context={context} />
34
- </div>}
35
- </div>;
18
+ return /* @__PURE__ */ jsxs("div", {
19
+ className: "openapi-response-body",
20
+ children: [headers.length > 0 ? /* @__PURE__ */ jsx(OpenAPIDisclosure, {
21
+ header: /* @__PURE__ */ jsx(OpenAPISchemaPresentation, {
22
+ context,
23
+ property: {
24
+ propertyName: tString(context.translation, "headers"),
25
+ schema: { type: "object" },
26
+ required: null
27
+ }
28
+ }),
29
+ icon: context.icons.plus,
30
+ label: (isExpanded) => tString(context.translation, isExpanded ? "hide" : "show", tString(context.translation, headers.length === 1 ? "header" : "headers")),
31
+ children: /* @__PURE__ */ jsx(OpenAPISchemaProperties, {
32
+ properties: headers.map(([name, header]) => parameterToProperty({
33
+ name,
34
+ ...header
35
+ })),
36
+ context
37
+ })
38
+ }) : null, mediaType?.schema && /* @__PURE__ */ jsx("div", {
39
+ className: "openapi-responsebody",
40
+ children: /* @__PURE__ */ jsx(OpenAPISchemaProperties, {
41
+ id: `response-${context.blockKey}`,
42
+ properties: [{
43
+ schema: mediaType.schema,
44
+ propertyName: tString(context.translation, "response"),
45
+ required: null
46
+ }],
47
+ context
48
+ })
49
+ })]
50
+ });
36
51
  }
37
52
 
38
53
  //#endregion