docusaurus-plugin-openapi-docs 0.0.0-618 → 0.0.0-684

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 (43) hide show
  1. package/README.md +3 -10
  2. package/lib/markdown/createAuthorization.d.ts +1 -0
  3. package/lib/markdown/createAuthorization.js +16 -0
  4. package/lib/markdown/createDeprecationNotice.js +1 -1
  5. package/lib/markdown/createHeading.d.ts +1 -0
  6. package/lib/markdown/createHeading.js +20 -0
  7. package/lib/markdown/createMethodEndpoint.d.ts +1 -0
  8. package/lib/markdown/createMethodEndpoint.js +14 -0
  9. package/lib/markdown/createParamsDetails.js +3 -1
  10. package/lib/markdown/createRequestHeader.d.ts +1 -0
  11. package/lib/markdown/createRequestHeader.js +13 -0
  12. package/lib/markdown/createRequestSchema.js +19 -15
  13. package/lib/markdown/createResponseSchema.js +7 -7
  14. package/lib/markdown/createSchema.js +97 -77
  15. package/lib/markdown/createSchema.test.d.ts +1 -0
  16. package/lib/markdown/createSchema.test.js +73 -0
  17. package/lib/markdown/createStatusCodes.js +38 -35
  18. package/lib/markdown/index.d.ts +1 -1
  19. package/lib/markdown/index.js +15 -6
  20. package/lib/openapi/openapi.js +29 -13
  21. package/lib/openapi/openapi.test.js +1 -0
  22. package/lib/options.js +1 -2
  23. package/lib/sidebars/index.js +2 -2
  24. package/lib/types.d.ts +3 -1
  25. package/package.json +8 -16
  26. package/src/markdown/__snapshots__/createSchema.test.ts.snap +98 -0
  27. package/src/markdown/createAuthorization.ts +13 -0
  28. package/src/markdown/createDeprecationNotice.ts +1 -1
  29. package/src/markdown/createHeading.ts +18 -0
  30. package/src/markdown/createMethodEndpoint.ts +12 -0
  31. package/src/markdown/createParamsDetails.ts +3 -1
  32. package/src/markdown/createRequestHeader.ts +10 -0
  33. package/src/markdown/createRequestSchema.ts +20 -15
  34. package/src/markdown/createResponseSchema.ts +8 -7
  35. package/src/markdown/createSchema.test.ts +56 -0
  36. package/src/markdown/createSchema.ts +106 -83
  37. package/src/markdown/createStatusCodes.ts +38 -35
  38. package/src/markdown/index.ts +17 -5
  39. package/src/openapi/openapi.test.ts +1 -0
  40. package/src/openapi/openapi.ts +25 -4
  41. package/src/options.ts +1 -2
  42. package/src/sidebars/index.ts +2 -2
  43. package/src/types.ts +3 -1
package/README.md CHANGED
@@ -31,15 +31,15 @@ Key Features:
31
31
 
32
32
  | Docusaurus OpenAPI Docs | Docusaurus |
33
33
  | ----------------------- | --------------- |
34
- | 1.x.x | `2.0.1 - 2.2.0` |
35
- | 2.x.x (beta) | `2.3.0 - 2.4.0` |
34
+ | 2.0.x (current) | `2.4.1 - 2.4.3` |
35
+ | 1.7.3 (legacy) | `2.0.1 - 2.2.0` |
36
36
 
37
37
  ## Bootstrapping from Template (new Docusaurus site)
38
38
 
39
39
  Run the following to bootstrap a Docsaurus v2 site (classic theme) with `docusaurus-openapi-docs`:
40
40
 
41
41
  ```bash
42
- npx create-docusaurus@2.2.0 my-website --package-manager yarn
42
+ npx create-docusaurus@2.4.3 my-website --package-manager yarn
43
43
  ```
44
44
 
45
45
  > When prompted to select a template choose `Git repository`.
@@ -71,13 +71,6 @@ Theme:
71
71
  yarn add docusaurus-theme-openapi-docs
72
72
  ```
73
73
 
74
- ## Compatibility Matrix
75
-
76
- | Docusaurus OpenAPI Docs | Docusaurus |
77
- | ----------------------- | ---------------- |
78
- | 1.x.x | `>=2.0.1 <2.3.0` |
79
- | 2.x.x (beta) | `>=2.3.0 <2.4.1` |
80
-
81
74
  ## Configuring `docusaurus.config.js` (Plugin and theme usage)
82
75
 
83
76
  Here is an example of properly configuring `docusaurus.config.js` file for `docusaurus-plugin-openapi-docs` and `docusaurus-theme-openapi-docs` usage.
@@ -0,0 +1 @@
1
+ export declare function createAuthorization(infoPath: string): string[] | undefined;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createAuthorization = void 0;
10
+ const utils_1 = require("./utils");
11
+ function createAuthorization(infoPath) {
12
+ if (!infoPath)
13
+ return undefined;
14
+ return [(0, utils_1.create)("SecuritySchemes", { infoPath: infoPath }), "\n\n"];
15
+ }
16
+ exports.createAuthorization = createAuthorization;
@@ -13,7 +13,7 @@ function createAdmonition({ children }) {
13
13
  }
14
14
  function createDeprecationNotice({ deprecated, description, }) {
15
15
  return (0, utils_1.guard)(deprecated, () => createAdmonition({
16
- children: description !== null && description !== void 0 ? description : "This endpoint has been deprecated and may be removed in future versions of the API.",
16
+ children: description !== null && description !== void 0 ? description : "This endpoint has been deprecated and may be replaced or removed in future versions of the API.",
17
17
  }));
18
18
  }
19
19
  exports.createDeprecationNotice = createDeprecationNotice;
@@ -0,0 +1 @@
1
+ export declare function createHeading(heading: string): string[];
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createHeading = void 0;
10
+ const utils_1 = require("./utils");
11
+ function createHeading(heading) {
12
+ return [
13
+ (0, utils_1.create)("h1", {
14
+ className: "openapi__heading",
15
+ children: `${heading}`,
16
+ }),
17
+ `\n\n`,
18
+ ];
19
+ }
20
+ exports.createHeading = createHeading;
@@ -0,0 +1 @@
1
+ export declare function createMethodEndpoint(method: String, path: String): string[];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createMethodEndpoint = void 0;
10
+ const utils_1 = require("./utils");
11
+ function createMethodEndpoint(method, path) {
12
+ return [(0, utils_1.create)("MethodEndpoint", { method: method, path: path }), "\n\n"];
13
+ }
14
+ exports.createMethodEndpoint = createMethodEndpoint;
@@ -19,13 +19,15 @@ function createParamsDetails({ parameters, type }) {
19
19
  return undefined;
20
20
  }
21
21
  return (0, createDetails_1.createDetails)({
22
+ className: "openapi-markdown__details",
22
23
  "data-collapsed": false,
23
24
  open: true,
24
25
  style: { marginBottom: "1rem" },
25
26
  children: [
26
27
  (0, createDetailsSummary_1.createDetailsSummary)({
27
28
  children: [
28
- (0, utils_1.create)("strong", {
29
+ (0, utils_1.create)("h3", {
30
+ className: "openapi-markdown__details-summary-header-params",
29
31
  children: `${type.charAt(0).toUpperCase() + type.slice(1)} Parameters`,
30
32
  }),
31
33
  ],
@@ -0,0 +1 @@
1
+ export declare function createRequestHeader(header: string): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createRequestHeader = void 0;
10
+ function createRequestHeader(header) {
11
+ return `## ${header}\n\n`;
12
+ }
13
+ exports.createRequestHeader = createRequestHeader;
@@ -24,6 +24,7 @@ function createRequestSchema({ title, body, ...rest }) {
24
24
  const mimeTypes = Object.keys(body.content);
25
25
  if (mimeTypes && mimeTypes.length > 1) {
26
26
  return (0, utils_1.create)("MimeTabs", {
27
+ className: "openapi-tabs__mime",
27
28
  schemaType: "request",
28
29
  children: mimeTypes.map((mimeType) => {
29
30
  const firstBody = body.content[mimeType].schema;
@@ -40,21 +41,22 @@ function createRequestSchema({ title, body, ...rest }) {
40
41
  value: `${mimeType}`,
41
42
  children: [
42
43
  (0, createDetails_1.createDetails)({
44
+ className: "openapi-markdown__details mime",
43
45
  "data-collapsed": false,
44
46
  open: true,
45
47
  ...rest,
46
48
  children: [
47
49
  (0, createDetailsSummary_1.createDetailsSummary)({
48
- style: { textAlign: "left" },
50
+ className: "openapi-markdown__details-summary-mime",
49
51
  children: [
50
- (0, utils_1.create)("strong", { children: `${title}` }),
52
+ (0, utils_1.create)("h3", {
53
+ className: "openapi-markdown__details-summary-header-body",
54
+ children: `${title}`,
55
+ }),
51
56
  (0, utils_1.guard)(body.required && body.required === true, () => [
52
- (0, utils_1.create)("strong", {
53
- style: {
54
- fontSize: "var(--ifm-code-font-size)",
55
- color: "var(--openapi-required)",
56
- },
57
- children: " required",
57
+ (0, utils_1.create)("span", {
58
+ className: "openapi-schema__required",
59
+ children: "required",
58
60
  }),
59
61
  ]),
60
62
  ],
@@ -93,31 +95,33 @@ function createRequestSchema({ title, body, ...rest }) {
93
95
  }
94
96
  }
95
97
  return (0, utils_1.create)("MimeTabs", {
98
+ className: "openapi-tabs__mime",
96
99
  children: [
97
100
  (0, utils_1.create)("TabItem", {
98
101
  label: randomFirstKey,
99
102
  value: `${randomFirstKey}-schema`,
100
103
  children: [
101
104
  (0, createDetails_1.createDetails)({
105
+ className: "openapi-markdown__details mime",
102
106
  "data-collapsed": false,
103
107
  open: true,
104
108
  ...rest,
105
109
  children: [
106
110
  (0, createDetailsSummary_1.createDetailsSummary)({
107
- style: { textAlign: "left" },
111
+ className: "openapi-markdown__details-summary-mime",
108
112
  children: [
109
- (0, utils_1.create)("strong", { children: `${title}` }),
113
+ (0, utils_1.create)("h3", {
114
+ className: "openapi-markdown__details-summary-header-body",
115
+ children: `${title}`,
116
+ }),
110
117
  (0, utils_1.guard)(firstBody.type === "array", (format) => (0, utils_1.create)("span", {
111
118
  style: { opacity: "0.6" },
112
119
  children: ` array`,
113
120
  })),
114
121
  (0, utils_1.guard)(body.required, () => [
115
122
  (0, utils_1.create)("strong", {
116
- style: {
117
- fontSize: "var(--ifm-code-font-size)",
118
- color: "var(--openapi-required)",
119
- },
120
- children: " required",
123
+ className: "openapi-schema__required",
124
+ children: "required",
121
125
  }),
122
126
  ]),
123
127
  ],
@@ -24,6 +24,7 @@ function createResponseSchema({ title, body, ...rest }) {
24
24
  const mimeTypes = Object.keys(body.content);
25
25
  if (mimeTypes && mimeTypes.length) {
26
26
  return (0, utils_1.create)("MimeTabs", {
27
+ className: "openapi-tabs__mime",
27
28
  schemaType: "response",
28
29
  children: mimeTypes.map((mimeType) => {
29
30
  var _a;
@@ -45,6 +46,7 @@ function createResponseSchema({ title, body, ...rest }) {
45
46
  value: `${mimeType}`,
46
47
  children: [
47
48
  (0, utils_1.create)("SchemaTabs", {
49
+ className: "openapi-tabs__schema",
48
50
  // TODO: determine if we should persist this
49
51
  // groupId: "schema-tabs",
50
52
  children: [
@@ -54,21 +56,19 @@ function createResponseSchema({ title, body, ...rest }) {
54
56
  value: `${title}`,
55
57
  children: [
56
58
  (0, createDetails_1.createDetails)({
59
+ className: "openapi-markdown__details response",
57
60
  "data-collapsed": false,
58
61
  open: true,
59
62
  ...rest,
60
63
  children: [
61
64
  (0, createDetailsSummary_1.createDetailsSummary)({
62
- style: { textAlign: "left" },
65
+ className: "openapi-markdown__details-summary-response",
63
66
  children: [
64
67
  (0, utils_1.create)("strong", { children: `${title}` }),
65
68
  (0, utils_1.guard)(body.required && body.required === true, () => [
66
- (0, utils_1.create)("strong", {
67
- style: {
68
- fontSize: "var(--ifm-code-font-size)",
69
- color: "var(--openapi-required)",
70
- },
71
- children: " required",
69
+ (0, utils_1.create)("span", {
70
+ className: "openapi-schema__required",
71
+ children: "required",
72
72
  }),
73
73
  ]),
74
74
  ],
@@ -5,8 +5,12 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
8
11
  Object.defineProperty(exports, "__esModule", { value: true });
9
12
  exports.createNodes = exports.mergeAllOf = void 0;
13
+ const clsx_1 = __importDefault(require("clsx"));
10
14
  const createArrayBracket_1 = require("./createArrayBracket");
11
15
  const createDescription_1 = require("./createDescription");
12
16
  const createDetails_1 = require("./createDetails");
@@ -279,35 +283,54 @@ function createDetailsNode(name, schemaName, schema, required, nullable) {
279
283
  className: "schemaItem",
280
284
  children: [
281
285
  (0, createDetails_1.createDetails)({
286
+ className: "openapi-markdown__details",
282
287
  children: [
283
288
  (0, createDetailsSummary_1.createDetailsSummary)({
284
289
  children: [
285
- (0, utils_1.create)("strong", { children: name }),
286
290
  (0, utils_1.create)("span", {
287
- style: { opacity: "0.6" },
288
- children: ` ${schemaName}`,
291
+ className: "openapi-schema__container",
292
+ children: [
293
+ (0, utils_1.create)("strong", {
294
+ className: (0, clsx_1.default)("openapi-schema__property", {
295
+ "openapi-schema__strikethrough": schema.deprecated,
296
+ }),
297
+ children: name,
298
+ }),
299
+ (0, utils_1.create)("span", {
300
+ className: "openapi-schema__name",
301
+ children: ` ${schemaName}`,
302
+ }),
303
+ (0, utils_1.guard)((Array.isArray(required)
304
+ ? required.includes(name)
305
+ : required === true) ||
306
+ schema.deprecated ||
307
+ nullable, () => [
308
+ (0, utils_1.create)("span", {
309
+ className: "openapi-schema__divider",
310
+ }),
311
+ ]),
312
+ (0, utils_1.guard)(nullable, () => [
313
+ (0, utils_1.create)("span", {
314
+ className: "openapi-schema__nullable",
315
+ children: "nullable",
316
+ }),
317
+ ]),
318
+ (0, utils_1.guard)(Array.isArray(required)
319
+ ? required.includes(name)
320
+ : required === true, () => [
321
+ (0, utils_1.create)("span", {
322
+ className: "openapi-schema__required",
323
+ children: "required",
324
+ }),
325
+ ]),
326
+ (0, utils_1.guard)(schema.deprecated, () => [
327
+ (0, utils_1.create)("span", {
328
+ className: "openapi-schema__deprecated",
329
+ children: "deprecated",
330
+ }),
331
+ ]),
332
+ ],
289
333
  }),
290
- (0, utils_1.guard)((schema.nullable && schema.nullable === true) ||
291
- (nullable && nullable === true), () => [
292
- (0, utils_1.create)("strong", {
293
- style: {
294
- fontSize: "var(--ifm-code-font-size)",
295
- color: "var(--openapi-nullable)",
296
- },
297
- children: " nullable",
298
- }),
299
- ]),
300
- (0, utils_1.guard)(Array.isArray(required)
301
- ? required.includes(name)
302
- : required === true, () => [
303
- (0, utils_1.create)("strong", {
304
- style: {
305
- fontSize: "var(--ifm-code-font-size)",
306
- color: "var(--openapi-required)",
307
- },
308
- children: " required",
309
- }),
310
- ]),
311
334
  ],
312
335
  }),
313
336
  (0, utils_1.create)("div", {
@@ -333,13 +356,12 @@ function createDetailsNode(name, schemaName, schema, required, nullable) {
333
356
  * For handling anyOf/oneOf properties.
334
357
  */
335
358
  function createAnyOneOfProperty(name, schemaName, schema, required, nullable) {
336
- const type = schema.oneOf ? "oneOf" : "anyOf";
337
- const children = schema[type] || [];
338
359
  return (0, utils_1.create)("SchemaItem", {
339
360
  collapsible: true,
340
361
  className: "schemaItem",
341
362
  children: [
342
363
  (0, createDetails_1.createDetails)({
364
+ className: "openapi-markdown__details",
343
365
  children: [
344
366
  (0, createDetailsSummary_1.createDetailsSummary)({
345
367
  children: [
@@ -384,38 +406,7 @@ function createAnyOneOfProperty(name, schemaName, schema, required, nullable) {
384
406
  })),
385
407
  ],
386
408
  }),
387
- (0, utils_1.create)("div", {
388
- children: [
389
- (0, utils_1.create)("span", {
390
- className: "badge badge--info",
391
- children: type,
392
- }),
393
- (0, utils_1.create)("SchemaTabs", {
394
- children: children.map((property, index) => {
395
- var _a;
396
- const label = (_a = property.title) !== null && _a !== void 0 ? _a : `MOD${index + 1}`;
397
- if (property.properties) {
398
- return (0, utils_1.create)("TabItem", {
399
- label: label,
400
- value: `${index}-property`,
401
- children: [createNodes(property)],
402
- });
403
- }
404
- return (0, utils_1.create)("TabItem", {
405
- label: label,
406
- value: `${index}-property`,
407
- children: [
408
- (0, utils_1.create)("p", { children: label }),
409
- (0, utils_1.guard)(schema.description, (description) => (0, utils_1.create)("div", {
410
- style: { marginTop: ".5rem", marginBottom: ".5rem" },
411
- children: (0, createDescription_1.createDescription)(description),
412
- })),
413
- ],
414
- });
415
- }),
416
- }),
417
- ],
418
- }),
409
+ createAnyOneOf(schema),
419
410
  ],
420
411
  }),
421
412
  ],
@@ -432,26 +423,55 @@ function createPropertyDiscriminator(name, schemaName, schema, discriminator, re
432
423
  if (discriminator.mapping === undefined) {
433
424
  return undefined;
434
425
  }
435
- return (0, utils_1.create)("SchemaItem", {
436
- name,
437
- required: Array.isArray(required) ? required.includes(name) : required,
438
- schemaName: schemaName,
439
- qualifierMessage: (0, schema_1.getQualifierMessage)(schema),
440
- schema: schema,
441
- collapsible: false,
442
- discriminator: true,
443
- children: [
444
- (0, utils_1.create)("DiscriminatorTabs", {
445
- children: Object.keys(discriminator === null || discriminator === void 0 ? void 0 : discriminator.mapping).map((key, index) => {
446
- const label = key;
447
- return (0, utils_1.create)("TabItem", {
448
- label: label,
449
- value: `${index}-item-discriminator`,
450
- children: createNodes(discriminator === null || discriminator === void 0 ? void 0 : discriminator.mapping[key]),
451
- });
426
+ return (0, utils_1.create)("div", {
427
+ className: "openapi-discriminator__item openapi-schema__list-item",
428
+ children: (0, utils_1.create)("div", {
429
+ children: [
430
+ (0, utils_1.create)("span", {
431
+ className: "openapi-schema__container",
432
+ children: [
433
+ (0, utils_1.create)("strong", {
434
+ className: "openapi-discriminator__name openapi-schema__property",
435
+ children: name,
436
+ }),
437
+ (0, utils_1.guard)(schemaName, (name) => (0, utils_1.create)("span", {
438
+ className: "openapi-schema__name",
439
+ children: ` ${schemaName}`,
440
+ })),
441
+ (0, utils_1.guard)(required, () => [
442
+ (0, utils_1.create)("span", {
443
+ className: "openapi-schema__required",
444
+ children: "required",
445
+ }),
446
+ ]),
447
+ ],
452
448
  }),
453
- }),
454
- ],
449
+ (0, utils_1.guard)((0, schema_1.getQualifierMessage)(discriminator), (message) => (0, utils_1.create)("div", {
450
+ style: {
451
+ paddingLeft: "1rem",
452
+ },
453
+ children: (0, createDescription_1.createDescription)(message),
454
+ })),
455
+ (0, utils_1.guard)(schema.description, (description) => (0, utils_1.create)("div", {
456
+ style: {
457
+ paddingLeft: "1rem",
458
+ },
459
+ children: (0, createDescription_1.createDescription)(description),
460
+ })),
461
+ (0, utils_1.create)("DiscriminatorTabs", {
462
+ className: "openapi-tabs__discriminator",
463
+ children: Object.keys(discriminator === null || discriminator === void 0 ? void 0 : discriminator.mapping).map((key, index) => {
464
+ const label = key;
465
+ return (0, utils_1.create)("TabItem", {
466
+ // className: "openapi-tabs__discriminator-item",
467
+ label: label,
468
+ value: `${index}-item-discriminator`,
469
+ children: [createNodes(discriminator === null || discriminator === void 0 ? void 0 : discriminator.mapping[key])],
470
+ });
471
+ }),
472
+ }),
473
+ ],
474
+ }),
455
475
  });
456
476
  }
457
477
  /**
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ const prettier = __importStar(require("prettier"));
33
+ const createSchema_1 = require("./createSchema");
34
+ describe("createNodes", () => {
35
+ it("should create readable MODs for oneOf primitive properties", () => {
36
+ const schema = {
37
+ type: "object",
38
+ properties: {
39
+ oneOfProperty: {
40
+ oneOf: [
41
+ {
42
+ type: "object",
43
+ properties: {
44
+ noseLength: {
45
+ type: "number",
46
+ },
47
+ },
48
+ required: ["noseLength"],
49
+ description: "Clown's nose length",
50
+ },
51
+ {
52
+ type: "array",
53
+ items: {
54
+ type: "string",
55
+ },
56
+ description: "Array of strings",
57
+ },
58
+ {
59
+ type: "boolean",
60
+ },
61
+ {
62
+ type: "number",
63
+ },
64
+ {
65
+ type: "string",
66
+ },
67
+ ],
68
+ },
69
+ },
70
+ };
71
+ expect((0, createSchema_1.createNodes)(schema).map((md) => prettier.format(md, { parser: "babel" }))).toMatchSnapshot();
72
+ });
73
+ });