docusaurus-plugin-openapi-docs 4.0.0 → 4.1.0

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.
@@ -0,0 +1,19 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import { create } from "./utils";
9
+
10
+ export function createCallbackMethodEndpoint(method: String, path: String) {
11
+ return [
12
+ create("MethodEndpoint", {
13
+ method: method,
14
+ path: path,
15
+ context: "callback",
16
+ }),
17
+ "\n\n",
18
+ ];
19
+ }
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
+ import { createCallbackMethodEndpoint } from "./createCallbackMethodEndpoint";
8
9
  import { createDescription } from "./createDescription";
9
- import { createMethodEndpoint } from "./createMethodEndpoint";
10
10
  import { createRequestBodyDetails } from "./createRequestBodyDetails";
11
11
  import { createStatusCodes } from "./createStatusCodes";
12
12
  import { create } from "./utils";
@@ -78,7 +78,7 @@ export function createCallbacks({ callbacks }: Props) {
78
78
  label: `${method.toUpperCase()} ${name}`,
79
79
  value: `${method}-${name}`,
80
80
  children: [
81
- createMethodEndpoint(method, path),
81
+ createCallbackMethodEndpoint(method, path),
82
82
  // TODO: add `deprecation notice` when markdown support is added
83
83
  createDescription(description),
84
84
  createRequestBodyDetails({
@@ -23,8 +23,9 @@ export function createDeprecationNotice({
23
23
  return guard(deprecated, () =>
24
24
  createAdmonition({
25
25
  children:
26
- clean(description) ??
27
- "This endpoint has been deprecated and may be replaced or removed in future versions of the API.",
26
+ description && description.length > 0
27
+ ? clean(description)
28
+ : "This endpoint has been deprecated and may be replaced or removed in future versions of the API.",
28
29
  })
29
30
  );
30
31
  }
@@ -8,5 +8,12 @@
8
8
  import { create } from "./utils";
9
9
 
10
10
  export function createMethodEndpoint(method: String, path: String) {
11
- return [create("MethodEndpoint", { method: method, path: path }), "\n\n"];
11
+ return [
12
+ create("MethodEndpoint", {
13
+ method: method,
14
+ path: path,
15
+ context: "endpoint",
16
+ }),
17
+ "\n\n",
18
+ ];
12
19
  }
@@ -43,12 +43,19 @@ export function createParamsDetails({ parameters, type }: Props) {
43
43
  create("div", {
44
44
  children: [
45
45
  create("ul", {
46
- children: params.map((param) =>
47
- create("ParamsItem", {
46
+ children: params.map((param) => {
47
+ return create("ParamsItem", {
48
48
  className: "paramsItem",
49
- param: param,
50
- })
51
- ),
49
+ param: {
50
+ ...param,
51
+ enumDescriptions: Object.entries(
52
+ param?.schema?.["x-enumDescriptions"] ??
53
+ param?.schema?.items?.["x-enumDescriptions"] ??
54
+ {}
55
+ ),
56
+ },
57
+ });
58
+ }),
52
59
  }),
53
60
  ],
54
61
  }),