docusaurus-plugin-openapi-docs 1.1.2 → 1.1.3

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.
@@ -16,7 +16,8 @@ const openapi_to_postmanv2_1 = __importDefault(require("@paloaltonetworks/openap
16
16
  const postman_collection_1 = __importDefault(require("@paloaltonetworks/postman-collection"));
17
17
  const chalk_1 = __importDefault(require("chalk"));
18
18
  const fs_extra_1 = __importDefault(require("fs-extra"));
19
- const lodash_1 = require("lodash");
19
+ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
20
+ const kebabCase_1 = __importDefault(require("lodash/kebabCase"));
20
21
  const index_1 = require("../index");
21
22
  const createExample_1 = require("./createExample");
22
23
  const loadAndResolveSpec_1 = require("./utils/loadAndResolveSpec");
@@ -41,7 +42,7 @@ function jsonToCollection(data) {
41
42
  async function createPostmanCollection(openapiData) {
42
43
  var _a, _b, _c, _d, _e, _f, _g, _h;
43
44
  // Create copy of openapiData
44
- const data = Object.assign({}, openapiData);
45
+ const data = (0, cloneDeep_1.default)(openapiData);
45
46
  // Including `servers` breaks postman, so delete all of them.
46
47
  delete data.servers;
47
48
  for (let pathItemObject of Object.values(data.paths)) {
@@ -61,7 +62,7 @@ function createItems(openapiData, sidebarOptions) {
61
62
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
62
63
  // TODO: Find a better way to handle this
63
64
  let items = [];
64
- const infoId = (0, lodash_1.kebabCase)(openapiData.info.title);
65
+ const infoId = (0, kebabCase_1.default)(openapiData.info.title);
65
66
  if ((sidebarOptions === null || sidebarOptions === void 0 ? void 0 : sidebarOptions.categoryLinkSource) === "tag") {
66
67
  // Only create an tag pages if categoryLinkSource set to tag.
67
68
  const tags = (_a = openapiData.tags) !== null && _a !== void 0 ? _a : [];
@@ -72,14 +73,13 @@ function createItems(openapiData, sidebarOptions) {
72
73
  .map((tag) => {
73
74
  var _a;
74
75
  const description = getTagDisplayName(tag.name, (_a = openapiData.tags) !== null && _a !== void 0 ? _a : []);
75
- const tagId = (0, lodash_1.kebabCase)(tag.name);
76
+ const tagId = (0, kebabCase_1.default)(tag.name);
76
77
  const tagPage = {
77
78
  type: "tag",
78
79
  id: tagId,
79
80
  unversionedId: tagId,
80
81
  title: description !== null && description !== void 0 ? description : "",
81
82
  description: description !== null && description !== void 0 ? description : "",
82
- slug: "/" + tagId,
83
83
  frontMatter: {},
84
84
  tag: {
85
85
  ...tag,
@@ -96,13 +96,14 @@ function createItems(openapiData, sidebarOptions) {
96
96
  unversionedId: infoId,
97
97
  title: openapiData.info.title,
98
98
  description: openapiData.info.description,
99
- slug: "/" + infoId,
100
99
  frontMatter: {},
101
100
  securitySchemes: (_b = openapiData.components) === null || _b === void 0 ? void 0 : _b.securitySchemes,
102
101
  info: {
103
102
  ...openapiData.info,
104
103
  tags: (_c = openapiData.tags) === null || _c === void 0 ? void 0 : _c.map((tagName) => { var _a; return getTagDisplayName(tagName.name, (_a = openapiData.tags) !== null && _a !== void 0 ? _a : []); }),
105
104
  title: (_d = openapiData.info.title) !== null && _d !== void 0 ? _d : "Introduction",
105
+ logo: openapiData.info["x-logo"],
106
+ darkLogo: openapiData.info["x-dark-logo"],
106
107
  },
107
108
  };
108
109
  items.push(infoPage);
@@ -116,8 +117,8 @@ function createItems(openapiData, sidebarOptions) {
116
117
  (_h = (_g = operationObject.summary) !== null && _g !== void 0 ? _g : operationObject.operationId) !== null && _h !== void 0 ? _h : "";
117
118
  }
118
119
  const baseId = operationObject.operationId
119
- ? (0, lodash_1.kebabCase)(operationObject.operationId)
120
- : (0, lodash_1.kebabCase)(operationObject.summary);
120
+ ? (0, kebabCase_1.default)(operationObject.operationId)
121
+ : (0, kebabCase_1.default)(operationObject.summary);
121
122
  const servers = (_k = (_j = operationObject.servers) !== null && _j !== void 0 ? _j : pathObject.servers) !== null && _k !== void 0 ? _k : openapiData.servers;
122
123
  const security = (_l = operationObject.security) !== null && _l !== void 0 ? _l : openapiData.security;
123
124
  // Add security schemes so we know how to handle security.
@@ -144,7 +145,6 @@ function createItems(openapiData, sidebarOptions) {
144
145
  unversionedId: baseId,
145
146
  title: title,
146
147
  description: description !== null && description !== void 0 ? description : "",
147
- slug: "/" + baseId,
148
148
  frontMatter: {},
149
149
  api: {
150
150
  ...defaults,
@@ -31,6 +31,13 @@ export interface InfoObject {
31
31
  license?: LicenseObject;
32
32
  version: string;
33
33
  tags?: String[];
34
+ "x-logo"?: LogoObject;
35
+ "x-dark-logo"?: LogoObject;
36
+ logo?: LogoObject;
37
+ darkLogo?: LogoObject;
38
+ }
39
+ export interface LogoObject {
40
+ url?: string;
34
41
  }
35
42
  export interface ContactObject {
36
43
  name?: string;
@@ -15,6 +15,7 @@ const openapi_core_1 = require("@redocly/openapi-core");
15
15
  const chalk_1 = __importDefault(require("chalk"));
16
16
  // @ts-ignore
17
17
  const swagger2openapi_1 = require("swagger2openapi");
18
+ const OpenAPIParser_1 = require("./services/OpenAPIParser");
18
19
  function serializer(replacer, cycleReplacer) {
19
20
  var stack = [], keys = [];
20
21
  if (cycleReplacer === undefined)
@@ -24,6 +25,18 @@ function serializer(replacer, cycleReplacer) {
24
25
  return value.title ? `circular(${value.title})` : "circular()";
25
26
  };
26
27
  return function (key, value) {
28
+ // Resolve discriminator ref pointers
29
+ if ((value === null || value === void 0 ? void 0 : value.discriminator) !== undefined) {
30
+ const parser = new OpenAPIParser_1.OpenAPIParser(stack[0]);
31
+ for (let [k, v] of Object.entries(value.discriminator.mapping)) {
32
+ const discriminator = k;
33
+ if (typeof v === "string" && v.charAt(0) === "#") {
34
+ const ref = v;
35
+ const resolvedRef = parser.byRef(ref);
36
+ value.discriminator.mapping[discriminator] = resolvedRef;
37
+ }
38
+ }
39
+ }
27
40
  if (stack.length > 0) {
28
41
  // @ts-ignore
29
42
  var thisPos = stack.indexOf(this);
@@ -9,6 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ const path_1 = __importDefault(require("path"));
12
13
  const clsx_1 = __importDefault(require("clsx"));
13
14
  const lodash_1 = require("lodash");
14
15
  const uniq_1 = __importDefault(require("lodash/uniq"));
@@ -98,8 +99,8 @@ function groupByTags(items, sidebarOptions, options, tags, docPath) {
98
99
  type: "generated-index",
99
100
  title: tag,
100
101
  slug: label
101
- ? "/category/" + (0, lodash_1.kebabCase)(label) + "/" + (0, lodash_1.kebabCase)(tag)
102
- : "/category/" + (0, lodash_1.kebabCase)(tag),
102
+ ? path_1.default.join("/category", basePath, (0, lodash_1.kebabCase)(label), (0, lodash_1.kebabCase)(tag))
103
+ : path_1.default.join("/category", basePath, (0, lodash_1.kebabCase)(tag)),
103
104
  };
104
105
  }
105
106
  return {
package/lib/types.d.ts CHANGED
@@ -51,7 +51,7 @@ export interface ApiMetadataBase {
51
51
  description: string;
52
52
  source: string;
53
53
  sourceDirName: string;
54
- slug: string;
54
+ slug?: string;
55
55
  permalink: string;
56
56
  sidebarPosition?: number;
57
57
  frontMatter: Record<string, unknown>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-openapi-docs",
3
3
  "description": "OpenAPI plugin for Docusaurus.",
4
- "version": "1.1.2",
4
+ "version": "1.1.3",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -28,8 +28,8 @@
28
28
  "watch": "tsc --watch"
29
29
  },
30
30
  "devDependencies": {
31
- "@docusaurus/module-type-aliases": "2.0.0-rc.1",
32
- "@docusaurus/types": "2.0.0-rc.1",
31
+ "@docusaurus/module-type-aliases": "2.0.1",
32
+ "@docusaurus/types": "2.0.1",
33
33
  "@types/fs-extra": "^9.0.13",
34
34
  "@types/js-yaml": "^4.0.5",
35
35
  "@types/json-pointer": "^1.0.31",
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@apidevtools/json-schema-ref-parser": "^9.0.9",
43
- "@docusaurus/mdx-loader": "2.0.0-rc.1",
44
- "@docusaurus/plugin-content-docs": "2.0.0-rc.1",
45
- "@docusaurus/utils": "2.0.0-rc.1",
46
- "@docusaurus/utils-validation": "2.0.0-rc.1",
43
+ "@docusaurus/mdx-loader": "2.0.1",
44
+ "@docusaurus/plugin-content-docs": "2.0.1",
45
+ "@docusaurus/utils": "2.0.1",
46
+ "@docusaurus/utils-validation": "2.0.1",
47
47
  "@paloaltonetworks/openapi-to-postmanv2": "3.1.0-hotfix.1",
48
48
  "@paloaltonetworks/postman-collection": "^4.1.0",
49
49
  "@redocly/openapi-core": "^1.0.0-beta.103",
@@ -67,5 +67,5 @@
67
67
  "engines": {
68
68
  "node": ">=14"
69
69
  },
70
- "gitHead": "0c66efff6ff553647265abdc27d4ca847c6d8045"
70
+ "gitHead": "4897267289b035aed8155f6001e14c80ba9003a8"
71
71
  }
@@ -0,0 +1,21 @@
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 { LogoObject } from "../openapi/types";
9
+ import { create, guard } from "./utils";
10
+
11
+ export function createLogo(
12
+ logo: LogoObject | undefined,
13
+ darkLogo: LogoObject | undefined
14
+ ) {
15
+ return guard(logo || darkLogo, () => [
16
+ create("ApiLogo", {
17
+ logo: logo,
18
+ darkLogo: darkLogo,
19
+ }),
20
+ ]);
21
+ }
@@ -99,6 +99,7 @@ function createAnyOneOf(schema: SchemaObject): any {
99
99
  }
100
100
 
101
101
  function createProperties(schema: SchemaObject) {
102
+ const discriminator = schema.discriminator;
102
103
  return Object.entries(schema.properties!).map(([key, val]) =>
103
104
  createEdges({
104
105
  name: key,
@@ -106,6 +107,7 @@ function createProperties(schema: SchemaObject) {
106
107
  required: Array.isArray(schema.required)
107
108
  ? schema.required.includes(key)
108
109
  : false,
110
+ discriminator,
109
111
  })
110
112
  );
111
113
  }
@@ -277,6 +279,110 @@ function createItems(schema: SchemaObject) {
277
279
  );
278
280
  }
279
281
 
282
+ /**
283
+ * For handling discriminators that do not map to a same-level property
284
+ */
285
+ function createDiscriminator(schema: SchemaObject) {
286
+ const discriminator = schema.discriminator;
287
+ const propertyName = discriminator?.propertyName;
288
+ const propertyType = "string"; // should always be string
289
+ const mapping: any = discriminator?.mapping;
290
+
291
+ // Explicit mapping is required since we can't support implicit
292
+ if (mapping === undefined) {
293
+ return undefined;
294
+ }
295
+
296
+ // Attempt to get the property description we want to display
297
+ // TODO: how to make it predictable when handling allOf
298
+ let propertyDescription;
299
+ const firstMappingSchema = mapping[Object.keys(mapping)[0]];
300
+ if (firstMappingSchema.properties !== undefined) {
301
+ propertyDescription =
302
+ firstMappingSchema.properties![propertyName!].description;
303
+ }
304
+ if (firstMappingSchema.allOf !== undefined) {
305
+ const { mergedSchemas }: { mergedSchemas: SchemaObject } = mergeAllOf(
306
+ firstMappingSchema.allOf
307
+ );
308
+ if (mergedSchemas.properties !== undefined) {
309
+ propertyDescription =
310
+ mergedSchemas.properties[propertyName!]?.description;
311
+ }
312
+ }
313
+
314
+ if (propertyDescription === undefined) {
315
+ if (
316
+ schema.properties !== undefined &&
317
+ schema.properties![propertyName!] !== undefined
318
+ ) {
319
+ propertyDescription = schema.properties![propertyName!].description;
320
+ }
321
+ }
322
+
323
+ return create("div", {
324
+ className: "discriminatorItem",
325
+ children: create("div", {
326
+ children: [
327
+ create("strong", {
328
+ style: { paddingLeft: "1rem" },
329
+ children: propertyName,
330
+ }),
331
+ guard(propertyType, (name) =>
332
+ create("span", {
333
+ style: { opacity: "0.6" },
334
+ children: ` ${propertyType}`,
335
+ })
336
+ ),
337
+ guard(getQualifierMessage(schema.discriminator as any), (message) =>
338
+ create("div", {
339
+ style: {
340
+ paddingLeft: "1rem",
341
+ },
342
+ children: createDescription(message),
343
+ })
344
+ ),
345
+ guard(propertyDescription, (description) =>
346
+ create("div", {
347
+ style: {
348
+ paddingLeft: "1rem",
349
+ },
350
+ children: createDescription(description),
351
+ })
352
+ ),
353
+ create("DiscriminatorTabs", {
354
+ children: Object.keys(mapping!).map((key, index) => {
355
+ if (mapping[key].allOf !== undefined) {
356
+ const { mergedSchemas }: { mergedSchemas: SchemaObject } =
357
+ mergeAllOf(mapping[key].allOf);
358
+ // Cleanup duplicate property from mapping schema
359
+ delete mergedSchemas.properties![propertyName!];
360
+ mapping[key] = mergedSchemas;
361
+ }
362
+
363
+ if (mapping[key].properties !== undefined) {
364
+ // Cleanup duplicate property from mapping schema
365
+ delete mapping[key].properties![propertyName!];
366
+ }
367
+
368
+ const label = key;
369
+ return create("TabItem", {
370
+ label: label,
371
+ value: `${index}-item-discriminator`,
372
+ children: [
373
+ create("div", {
374
+ style: { marginLeft: "-4px" },
375
+ children: createNodes(mapping[key]),
376
+ }),
377
+ ],
378
+ });
379
+ }),
380
+ }),
381
+ ],
382
+ }),
383
+ });
384
+ }
385
+
280
386
  function createDetailsNode(
281
387
  name: string,
282
388
  schemaName: string,
@@ -331,18 +437,109 @@ function createDetailsNode(
331
437
  });
332
438
  }
333
439
 
440
+ /**
441
+ * For handling discriminators that map to a same-level property (like 'petType').
442
+ * Note: These should only be encountered while iterating through properties.
443
+ */
444
+ function createPropertyDiscriminator(
445
+ name: string,
446
+ schemaName: string,
447
+ schema: SchemaObject,
448
+ discriminator: any,
449
+ required: any
450
+ ): any {
451
+ if (schema === undefined) {
452
+ return undefined;
453
+ }
454
+
455
+ if (discriminator.mapping === undefined) {
456
+ return undefined;
457
+ }
458
+
459
+ return create("div", {
460
+ className: "discriminatorItem",
461
+ children: create("div", {
462
+ children: [
463
+ create("strong", { style: { paddingLeft: "1rem" }, children: name }),
464
+ guard(schemaName, (name) =>
465
+ create("span", {
466
+ style: { opacity: "0.6" },
467
+ children: ` ${schemaName}`,
468
+ })
469
+ ),
470
+ guard(required, () => [
471
+ create("strong", {
472
+ style: {
473
+ fontSize: "var(--ifm-code-font-size)",
474
+ color: "var(--openapi-required)",
475
+ },
476
+ children: " required",
477
+ }),
478
+ ]),
479
+ guard(getQualifierMessage(discriminator), (message) =>
480
+ create("div", {
481
+ style: {
482
+ paddingLeft: "1rem",
483
+ },
484
+ children: createDescription(message),
485
+ })
486
+ ),
487
+ guard(schema.description, (description) =>
488
+ create("div", {
489
+ style: {
490
+ paddingLeft: "1rem",
491
+ },
492
+ children: createDescription(description),
493
+ })
494
+ ),
495
+ create("DiscriminatorTabs", {
496
+ children: Object.keys(discriminator?.mapping!).map((key, index) => {
497
+ const label = key;
498
+ return create("TabItem", {
499
+ label: label,
500
+ value: `${index}-item-discriminator`,
501
+ children: [
502
+ create("div", {
503
+ style: { marginLeft: "-4px" },
504
+ children: createNodes(discriminator?.mapping[key]),
505
+ }),
506
+ ],
507
+ });
508
+ }),
509
+ }),
510
+ ],
511
+ }),
512
+ });
513
+ }
514
+
334
515
  interface EdgeProps {
335
516
  name: string;
336
517
  schema: SchemaObject;
337
518
  required: boolean;
519
+ discriminator?: any | unknown;
338
520
  }
339
521
 
340
522
  /**
341
523
  * Creates the edges or "leaves" of a schema tree. Edges can branch into sub-nodes with createDetails().
342
524
  */
343
- function createEdges({ name, schema, required }: EdgeProps): any {
525
+ function createEdges({
526
+ name,
527
+ schema,
528
+ required,
529
+ discriminator,
530
+ }: EdgeProps): any {
344
531
  const schemaName = getSchemaName(schema);
345
532
 
533
+ if (discriminator !== undefined && discriminator.propertyName === name) {
534
+ return createPropertyDiscriminator(
535
+ name,
536
+ "string",
537
+ schema,
538
+ discriminator,
539
+ required
540
+ );
541
+ }
542
+
346
543
  if (schema.oneOf !== undefined || schema.anyOf !== undefined) {
347
544
  return createDetailsNode(name, schemaName, schema, required);
348
545
  }
@@ -409,6 +606,10 @@ function createEdges({ name, schema, required }: EdgeProps): any {
409
606
  * Creates a hierarchical level of a schema tree. Nodes produce edges that can branch into sub-nodes with edges, recursively.
410
607
  */
411
608
  function createNodes(schema: SchemaObject): any {
609
+ if (schema.discriminator !== undefined) {
610
+ return createDiscriminator(schema);
611
+ }
612
+
412
613
  if (schema.oneOf !== undefined || schema.anyOf !== undefined) {
413
614
  return createAnyOneOf(schema);
414
615
  }
@@ -7,13 +7,86 @@
7
7
 
8
8
  import { ApiItem } from "../types";
9
9
  import { createDescription } from "./createDescription";
10
+ import { createDetails } from "./createDetails";
11
+ import { createDetailsSummary } from "./createDetailsSummary";
10
12
  import { createSchemaDetails } from "./createSchemaDetails";
11
13
  import { create } from "./utils";
14
+ import { guard } from "./utils";
12
15
 
13
16
  interface Props {
14
17
  responses: ApiItem["responses"];
15
18
  }
16
19
 
20
+ function createResponseHeaders(responseHeaders: any) {
21
+ return guard(responseHeaders, () =>
22
+ create("ul", {
23
+ style: { marginLeft: "1rem" },
24
+ children: [
25
+ Object.entries(responseHeaders).map(([headerName, headerObj]) => {
26
+ const {
27
+ description,
28
+ schema: { type },
29
+ example,
30
+ }: any = headerObj;
31
+
32
+ return create("li", {
33
+ class: "schemaItem",
34
+ children: [
35
+ createDetailsSummary({
36
+ children: [
37
+ create("strong", { children: headerName }),
38
+ guard(type, () => [
39
+ create("span", {
40
+ style: { opacity: "0.6" },
41
+ children: ` ${type}`,
42
+ }),
43
+ ]),
44
+ ],
45
+ }),
46
+ create("div", {
47
+ children: [
48
+ guard(description, (description) =>
49
+ create("div", {
50
+ style: {
51
+ marginTop: ".5rem",
52
+ marginBottom: ".5rem",
53
+ },
54
+ children: [
55
+ guard(example, () => `Example: ${example}`),
56
+ createDescription(description),
57
+ ],
58
+ })
59
+ ),
60
+ ],
61
+ }),
62
+ ],
63
+ });
64
+ }),
65
+ ],
66
+ })
67
+ );
68
+ }
69
+
70
+ function createResponseExamples(responseExamples: any) {
71
+ return Object.entries(responseExamples).map(
72
+ ([exampleName, exampleValue]: any) => {
73
+ const camelToSpaceName = exampleName.replace(/([A-Z])/g, " $1");
74
+ let finalFormattedName =
75
+ camelToSpaceName.charAt(0).toUpperCase() + camelToSpaceName.slice(1);
76
+
77
+ return create("TabItem", {
78
+ label: `${finalFormattedName}`,
79
+ value: `${finalFormattedName}`,
80
+ children: [
81
+ create("ResponseSamples", {
82
+ responseExample: JSON.stringify(exampleValue.value, null, 2),
83
+ }),
84
+ ],
85
+ });
86
+ }
87
+ );
88
+ }
89
+
17
90
  export function createStatusCodes({ responses }: Props) {
18
91
  if (responses === undefined) {
19
92
  return undefined;
@@ -28,6 +101,13 @@ export function createStatusCodes({ responses }: Props) {
28
101
  children: [
29
102
  create("ApiTabs", {
30
103
  children: codes.map((code) => {
104
+ const responseHeaders: any = responses[code].headers;
105
+ const responseContent: any = responses[code].content;
106
+ const responseContentKey: any =
107
+ responseContent && Object.keys(responseContent)[0];
108
+ const responseExamples: any =
109
+ responseContentKey && responseContent[responseContentKey].examples;
110
+
31
111
  return create("TabItem", {
32
112
  label: code,
33
113
  value: code,
@@ -35,14 +115,68 @@ export function createStatusCodes({ responses }: Props) {
35
115
  create("div", {
36
116
  children: createDescription(responses[code].description),
37
117
  }),
38
- create("div", {
39
- children: createSchemaDetails({
40
- title: "Schema",
41
- body: {
42
- content: responses[code].content,
43
- },
44
- }),
45
- }),
118
+ guard(responseExamples, () =>
119
+ create("SchemaTabs", {
120
+ children: [
121
+ create("TabTtem", {
122
+ label: "Schema",
123
+ value: "Schema",
124
+ children: [
125
+ responseHeaders &&
126
+ createDetails({
127
+ "data-collaposed": false,
128
+ open: true,
129
+ style: { textAlign: "left" },
130
+ children: [
131
+ createDetailsSummary({
132
+ children: [
133
+ create("strong", {
134
+ children: "Response Headers",
135
+ }),
136
+ ],
137
+ }),
138
+ createResponseHeaders(responseHeaders),
139
+ ],
140
+ }),
141
+ create("div", {
142
+ children: createSchemaDetails({
143
+ title: "Schema",
144
+ body: {
145
+ content: responses[code].content,
146
+ },
147
+ }),
148
+ }),
149
+ ],
150
+ }),
151
+ createResponseExamples(responseExamples),
152
+ ],
153
+ })
154
+ ),
155
+ guard(responseHeaders, () =>
156
+ createDetails({
157
+ "data-collaposed": false,
158
+ open: true,
159
+ style: { textAlign: "left" },
160
+ children: [
161
+ createDetailsSummary({
162
+ children: [
163
+ create("strong", { children: "Response Headers" }),
164
+ ],
165
+ }),
166
+ createResponseHeaders(responseHeaders),
167
+ ],
168
+ })
169
+ ),
170
+ guard(!responseExamples, () =>
171
+ create("div", {
172
+ children: createSchemaDetails({
173
+ title: "Schema",
174
+ body: {
175
+ content: responses[code].content,
176
+ },
177
+ }),
178
+ })
179
+ ),
46
180
  ],
47
181
  });
48
182
  }),
@@ -18,6 +18,7 @@ import { createContactInfo } from "./createContactInfo";
18
18
  import { createDeprecationNotice } from "./createDeprecationNotice";
19
19
  import { createDescription } from "./createDescription";
20
20
  import { createLicense } from "./createLicense";
21
+ import { createLogo } from "./createLogo";
21
22
  import { createParamsDetails } from "./createParamsDetails";
22
23
  import { createRequestBodyDetails } from "./createRequestBodyDetails";
23
24
  import { createStatusCodes } from "./createStatusCodes";
@@ -37,10 +38,12 @@ export function createApiPageMD({
37
38
  },
38
39
  }: ApiPageMetadata) {
39
40
  return render([
41
+ `import ApiTabs from "@theme/ApiTabs";\n`,
40
42
  `import ParamsItem from "@theme/ParamsItem";\n`,
43
+ `import ResponseSamples from "@theme/ResponseSamples";\n`,
41
44
  `import SchemaItem from "@theme/SchemaItem"\n`,
42
- `import ApiTabs from "@theme/ApiTabs";\n`,
43
45
  `import SchemaTabs from "@theme/SchemaTabs";\n`,
46
+ `import DiscriminatorTabs from "@theme/DiscriminatorTabs";\n`,
44
47
  `import TabItem from "@theme/TabItem";\n\n`,
45
48
  `## ${escape(title)}\n\n`,
46
49
  createDeprecationNotice({ deprecated, description: deprecatedDescription }),
@@ -55,14 +58,26 @@ export function createApiPageMD({
55
58
  }
56
59
 
57
60
  export function createInfoPageMD({
58
- info: { title, version, description, contact, license, termsOfService },
61
+ info: {
62
+ title,
63
+ version,
64
+ description,
65
+ contact,
66
+ license,
67
+ termsOfService,
68
+ logo,
69
+ darkLogo,
70
+ },
59
71
  securitySchemes,
60
72
  }: InfoPageMetadata) {
61
73
  return render([
74
+ `import ApiLogo from "@theme/ApiLogo";\n`,
62
75
  `import Tabs from "@theme/Tabs";\n`,
63
76
  `import TabItem from "@theme/TabItem";\n\n`,
77
+
64
78
  createVersionBadge(version),
65
79
  `# ${escape(title)}\n\n`,
80
+ createLogo(logo, darkLogo),
66
81
  createDescription(description),
67
82
  createAuthentication(securitySchemes as unknown as SecuritySchemeObject),
68
83
  createContactInfo(contact as ContactObject),