docusaurus-plugin-openapi-docs 0.0.0-407 → 0.0.0-410

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.
@@ -61,12 +61,25 @@ function getQualifierMessage(schema) {
61
61
  let qualifierGroups = [];
62
62
  if (schema.minLength || schema.maxLength) {
63
63
  let lengthQualifier = "";
64
- if (schema.minLength) {
65
- lengthQualifier += `${schema.minLength} ≤ `;
64
+ let minLength;
65
+ let maxLength;
66
+ if (schema.minLength && schema.minLength > 1) {
67
+ minLength = `\`>= ${schema.minLength} characters\``;
68
+ }
69
+ if (schema.minLength && schema.minLength === 1) {
70
+ minLength = `\`non-empty\``;
66
71
  }
67
- lengthQualifier += "length";
68
72
  if (schema.maxLength) {
69
- lengthQualifier += ` ${schema.maxLength}`;
73
+ maxLength = `\`<= ${schema.maxLength} characters\``;
74
+ }
75
+ if (minLength && !maxLength) {
76
+ lengthQualifier += minLength;
77
+ }
78
+ if (maxLength && !minLength) {
79
+ lengthQualifier += maxLength;
80
+ }
81
+ if (minLength && maxLength) {
82
+ lengthQualifier += `${minLength} and ${maxLength}`;
70
83
  }
71
84
  qualifierGroups.push(lengthQualifier);
72
85
  }
@@ -75,24 +88,34 @@ function getQualifierMessage(schema) {
75
88
  typeof schema.exclusiveMinimum === "number" ||
76
89
  typeof schema.exclusiveMaximum === "number") {
77
90
  let minmaxQualifier = "";
91
+ let minimum;
92
+ let maximum;
78
93
  if (typeof schema.exclusiveMinimum === "number") {
79
- minmaxQualifier += `${schema.exclusiveMinimum} < `;
94
+ minimum = `\`> ${schema.exclusiveMinimum}\``;
80
95
  }
81
96
  else if (schema.minimum && !schema.exclusiveMinimum) {
82
- minmaxQualifier += `${schema.minimum} ≤ `;
97
+ minimum = `\`>= ${schema.minimum}\``;
83
98
  }
84
99
  else if (schema.minimum && schema.exclusiveMinimum === true) {
85
- minmaxQualifier += `${schema.minimum} < `;
100
+ minimum = `\`> ${schema.minimum}\``;
86
101
  }
87
- minmaxQualifier += "value";
88
102
  if (typeof schema.exclusiveMaximum === "number") {
89
- minmaxQualifier += ` < ${schema.exclusiveMaximum}`;
103
+ maximum = `\`< ${schema.exclusiveMaximum}\``;
90
104
  }
91
105
  else if (schema.maximum && !schema.exclusiveMaximum) {
92
- minmaxQualifier += ` ${schema.maximum}`;
106
+ maximum = `\`<= ${schema.maximum}\``;
93
107
  }
94
108
  else if (schema.maximum && schema.exclusiveMaximum === true) {
95
- minmaxQualifier += ` < ${schema.maximum}`;
109
+ maximum = `\`< ${schema.maximum}\``;
110
+ }
111
+ if (minimum && !maximum) {
112
+ minmaxQualifier += minimum;
113
+ }
114
+ if (maximum && !minimum) {
115
+ minmaxQualifier += maximum;
116
+ }
117
+ if (minimum && maximum) {
118
+ minmaxQualifier += `${minimum} and ${maximum}`;
96
119
  }
97
120
  qualifierGroups.push(minmaxQualifier);
98
121
  }
@@ -109,10 +132,10 @@ function getQualifierMessage(schema) {
109
132
  qualifierGroups.push(`[${schema.enum.map((e) => `\`${e}\``).join(", ")}]`);
110
133
  }
111
134
  if (schema.minItems) {
112
- qualifierGroups.push(`items >= ${schema.minItems}`);
135
+ qualifierGroups.push(`\`>= ${schema.minItems}\``);
113
136
  }
114
137
  if (schema.maxItems) {
115
- qualifierGroups.push(`items <= ${schema.maxItems}`);
138
+ qualifierGroups.push(`\`<= ${schema.maxItems}\``);
116
139
  }
117
140
  if (qualifierGroups.length === 0) {
118
141
  return undefined;
@@ -16,17 +16,17 @@ describe("getQualifierMessage", () => {
16
16
  // minLength + maxLength
17
17
  //
18
18
  it("should render minLength", () => {
19
- const expected = "**Possible values:** 1 ≤ length";
19
+ const expected = "**Possible values:** `non-empty`";
20
20
  const actual = (0, schema_1.getQualifierMessage)({ minLength: 1 });
21
21
  expect(actual).toBe(expected);
22
22
  });
23
23
  it("should render maxLength", () => {
24
- const expected = "**Possible values:** length 40";
24
+ const expected = "**Possible values:** `<= 40 characters`";
25
25
  const actual = (0, schema_1.getQualifierMessage)({ maxLength: 40 });
26
26
  expect(actual).toBe(expected);
27
27
  });
28
28
  it("should render minLength and maxLength", () => {
29
- const expected = "**Possible values:** 1 length 40";
29
+ const expected = "**Possible values:** `non-empty` and `<= 40 characters`";
30
30
  const actual = (0, schema_1.getQualifierMessage)({ minLength: 1, maxLength: 40 });
31
31
  expect(actual).toBe(expected);
32
32
  });
@@ -39,7 +39,7 @@ describe("getQualifierMessage", () => {
39
39
  expect(actual).toBe(expected);
40
40
  });
41
41
  it("should render multiple string qualifiers", () => {
42
- const expected = "**Possible values:** 1 length 40, Value must match regular expression `^[a-zA-Z0-9_-]*$`";
42
+ const expected = "**Possible values:** `non-empty` and `<= 40 characters`, Value must match regular expression `^[a-zA-Z0-9_-]*$`";
43
43
  const actual = (0, schema_1.getQualifierMessage)({
44
44
  minLength: 1,
45
45
  maxLength: 40,
@@ -59,42 +59,42 @@ describe("getQualifierMessage", () => {
59
59
  // minimum + maximum + exclusiveMinimum + exclusiveMaximum
60
60
  //
61
61
  it("should render minimum", () => {
62
- const expected = "**Possible values:** 1 ≤ value";
62
+ const expected = "**Possible values:** `>= 1`";
63
63
  const actual = (0, schema_1.getQualifierMessage)({ minimum: 1 });
64
64
  expect(actual).toBe(expected);
65
65
  });
66
66
  it("should render maximum", () => {
67
- const expected = "**Possible values:** value 40";
67
+ const expected = "**Possible values:** `<= 40`";
68
68
  const actual = (0, schema_1.getQualifierMessage)({ maximum: 40 });
69
69
  expect(actual).toBe(expected);
70
70
  });
71
71
  it("should render numeric exclusiveMinimum", () => {
72
- const expected = "**Possible values:** 1 < value";
72
+ const expected = "**Possible values:** `> 1`";
73
73
  const actual = (0, schema_1.getQualifierMessage)({ exclusiveMinimum: 1 });
74
74
  expect(actual).toBe(expected);
75
75
  });
76
76
  it("should render numeric exclusiveMaximum", () => {
77
- const expected = "**Possible values:** value < 40";
77
+ const expected = "**Possible values:** `< 40`";
78
78
  const actual = (0, schema_1.getQualifierMessage)({ exclusiveMaximum: 40 });
79
79
  expect(actual).toBe(expected);
80
80
  });
81
81
  it("should render boolean exclusiveMinimum", () => {
82
- const expected = "**Possible values:** 1 < value";
82
+ const expected = "**Possible values:** `> 1`";
83
83
  const actual = (0, schema_1.getQualifierMessage)({ minimum: 1, exclusiveMinimum: true });
84
84
  expect(actual).toBe(expected);
85
85
  });
86
86
  it("should render boolean exclusiveMaximum", () => {
87
- const expected = "**Possible values:** value < 40";
87
+ const expected = "**Possible values:** `< 40`";
88
88
  const actual = (0, schema_1.getQualifierMessage)({ maximum: 40, exclusiveMaximum: true });
89
89
  expect(actual).toBe(expected);
90
90
  });
91
91
  it("should render minimum when exclusiveMinimum is false", () => {
92
- const expected = "**Possible values:** 1 ≤ value";
92
+ const expected = "**Possible values:** `>= 1`";
93
93
  const actual = (0, schema_1.getQualifierMessage)({ minimum: 1, exclusiveMinimum: false });
94
94
  expect(actual).toBe(expected);
95
95
  });
96
96
  it("should render maximum when exclusiveMaximum is false", () => {
97
- const expected = "**Possible values:** value 40";
97
+ const expected = "**Possible values:** `<= 40`";
98
98
  const actual = (0, schema_1.getQualifierMessage)({
99
99
  maximum: 40,
100
100
  exclusiveMaximum: false,
@@ -102,12 +102,12 @@ describe("getQualifierMessage", () => {
102
102
  expect(actual).toBe(expected);
103
103
  });
104
104
  it("should render minimum and maximum", () => {
105
- const expected = "**Possible values:** 1 value 40";
105
+ const expected = "**Possible values:** `>= 1` and `<= 40`";
106
106
  const actual = (0, schema_1.getQualifierMessage)({ minimum: 1, maximum: 40 });
107
107
  expect(actual).toBe(expected);
108
108
  });
109
109
  it("should render boolean exclusiveMinimum and maximum", () => {
110
- const expected = "**Possible values:** 1 < value 40";
110
+ const expected = "**Possible values:** `> 1` and `<= 40`";
111
111
  const actual = (0, schema_1.getQualifierMessage)({
112
112
  minimum: 1,
113
113
  maximum: 40,
@@ -116,7 +116,7 @@ describe("getQualifierMessage", () => {
116
116
  expect(actual).toBe(expected);
117
117
  });
118
118
  it("should render minimum and boolean exclusiveMaximum", () => {
119
- const expected = "**Possible values:** 1 value < 40";
119
+ const expected = "**Possible values:** `>= 1` and `< 40`";
120
120
  const actual = (0, schema_1.getQualifierMessage)({
121
121
  minimum: 1,
122
122
  maximum: 40,
@@ -125,7 +125,7 @@ describe("getQualifierMessage", () => {
125
125
  expect(actual).toBe(expected);
126
126
  });
127
127
  it("should render numeric exclusiveMinimum and maximum", () => {
128
- const expected = "**Possible values:** 1 < value 40";
128
+ const expected = "**Possible values:** `> 1` and `<= 40`";
129
129
  const actual = (0, schema_1.getQualifierMessage)({
130
130
  exclusiveMinimum: 1,
131
131
  maximum: 40,
@@ -133,7 +133,7 @@ describe("getQualifierMessage", () => {
133
133
  expect(actual).toBe(expected);
134
134
  });
135
135
  it("should render minimum and numeric exclusiveMaximum", () => {
136
- const expected = "**Possible values:** 1 value < 40";
136
+ const expected = "**Possible values:** `>= 1` and `< 40`";
137
137
  const actual = (0, schema_1.getQualifierMessage)({
138
138
  minimum: 1,
139
139
  exclusiveMaximum: 40,
@@ -141,7 +141,7 @@ describe("getQualifierMessage", () => {
141
141
  expect(actual).toBe(expected);
142
142
  });
143
143
  it("should render numeric exclusiveMinimum and boolean exclusiveMaximum", () => {
144
- const expected = "**Possible values:** 1 < value < 40";
144
+ const expected = "**Possible values:** `> 1` and `< 40`";
145
145
  const actual = (0, schema_1.getQualifierMessage)({
146
146
  exclusiveMinimum: 1,
147
147
  maximum: 40,
@@ -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,7 +96,6 @@ 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: {
@@ -116,8 +115,8 @@ function createItems(openapiData, sidebarOptions) {
116
115
  (_h = (_g = operationObject.summary) !== null && _g !== void 0 ? _g : operationObject.operationId) !== null && _h !== void 0 ? _h : "";
117
116
  }
118
117
  const baseId = operationObject.operationId
119
- ? (0, lodash_1.kebabCase)(operationObject.operationId)
120
- : (0, lodash_1.kebabCase)(operationObject.summary);
118
+ ? (0, kebabCase_1.default)(operationObject.operationId)
119
+ : (0, kebabCase_1.default)(operationObject.summary);
121
120
  const servers = (_k = (_j = operationObject.servers) !== null && _j !== void 0 ? _j : pathObject.servers) !== null && _k !== void 0 ? _k : openapiData.servers;
122
121
  const security = (_l = operationObject.security) !== null && _l !== void 0 ? _l : openapiData.security;
123
122
  // Add security schemes so we know how to handle security.
@@ -144,7 +143,6 @@ function createItems(openapiData, sidebarOptions) {
144
143
  unversionedId: baseId,
145
144
  title: title,
146
145
  description: description !== null && description !== void 0 ? description : "",
147
- slug: "/" + baseId,
148
146
  frontMatter: {},
149
147
  api: {
150
148
  ...defaults,
@@ -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": "0.0.0-407",
4
+ "version": "0.0.0-410",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -67,5 +67,5 @@
67
67
  "engines": {
68
68
  "node": ">=14"
69
69
  },
70
- "gitHead": "8dd2c3d99a5d48f98a5b37aeb3451f68d66ebac0"
70
+ "gitHead": "a988ec527e7daefea40dfafa5b7bed404b7d2e0c"
71
71
  }
@@ -17,19 +17,19 @@ describe("getQualifierMessage", () => {
17
17
  // minLength + maxLength
18
18
  //
19
19
  it("should render minLength", () => {
20
- const expected = "**Possible values:** 1 ≤ length";
20
+ const expected = "**Possible values:** `non-empty`";
21
21
  const actual = getQualifierMessage({ minLength: 1 });
22
22
  expect(actual).toBe(expected);
23
23
  });
24
24
 
25
25
  it("should render maxLength", () => {
26
- const expected = "**Possible values:** length 40";
26
+ const expected = "**Possible values:** `<= 40 characters`";
27
27
  const actual = getQualifierMessage({ maxLength: 40 });
28
28
  expect(actual).toBe(expected);
29
29
  });
30
30
 
31
31
  it("should render minLength and maxLength", () => {
32
- const expected = "**Possible values:** 1 length 40";
32
+ const expected = "**Possible values:** `non-empty` and `<= 40 characters`";
33
33
  const actual = getQualifierMessage({ minLength: 1, maxLength: 40 });
34
34
  expect(actual).toBe(expected);
35
35
  });
@@ -46,7 +46,7 @@ describe("getQualifierMessage", () => {
46
46
 
47
47
  it("should render multiple string qualifiers", () => {
48
48
  const expected =
49
- "**Possible values:** 1 length 40, Value must match regular expression `^[a-zA-Z0-9_-]*$`";
49
+ "**Possible values:** `non-empty` and `<= 40 characters`, Value must match regular expression `^[a-zA-Z0-9_-]*$`";
50
50
  const actual = getQualifierMessage({
51
51
  minLength: 1,
52
52
  maxLength: 40,
@@ -68,49 +68,49 @@ describe("getQualifierMessage", () => {
68
68
  // minimum + maximum + exclusiveMinimum + exclusiveMaximum
69
69
  //
70
70
  it("should render minimum", () => {
71
- const expected = "**Possible values:** 1 ≤ value";
71
+ const expected = "**Possible values:** `>= 1`";
72
72
  const actual = getQualifierMessage({ minimum: 1 });
73
73
  expect(actual).toBe(expected);
74
74
  });
75
75
 
76
76
  it("should render maximum", () => {
77
- const expected = "**Possible values:** value 40";
77
+ const expected = "**Possible values:** `<= 40`";
78
78
  const actual = getQualifierMessage({ maximum: 40 });
79
79
  expect(actual).toBe(expected);
80
80
  });
81
81
 
82
82
  it("should render numeric exclusiveMinimum", () => {
83
- const expected = "**Possible values:** 1 < value";
83
+ const expected = "**Possible values:** `> 1`";
84
84
  const actual = getQualifierMessage({ exclusiveMinimum: 1 });
85
85
  expect(actual).toBe(expected);
86
86
  });
87
87
 
88
88
  it("should render numeric exclusiveMaximum", () => {
89
- const expected = "**Possible values:** value < 40";
89
+ const expected = "**Possible values:** `< 40`";
90
90
  const actual = getQualifierMessage({ exclusiveMaximum: 40 });
91
91
  expect(actual).toBe(expected);
92
92
  });
93
93
 
94
94
  it("should render boolean exclusiveMinimum", () => {
95
- const expected = "**Possible values:** 1 < value";
95
+ const expected = "**Possible values:** `> 1`";
96
96
  const actual = getQualifierMessage({ minimum: 1, exclusiveMinimum: true });
97
97
  expect(actual).toBe(expected);
98
98
  });
99
99
 
100
100
  it("should render boolean exclusiveMaximum", () => {
101
- const expected = "**Possible values:** value < 40";
101
+ const expected = "**Possible values:** `< 40`";
102
102
  const actual = getQualifierMessage({ maximum: 40, exclusiveMaximum: true });
103
103
  expect(actual).toBe(expected);
104
104
  });
105
105
 
106
106
  it("should render minimum when exclusiveMinimum is false", () => {
107
- const expected = "**Possible values:** 1 ≤ value";
107
+ const expected = "**Possible values:** `>= 1`";
108
108
  const actual = getQualifierMessage({ minimum: 1, exclusiveMinimum: false });
109
109
  expect(actual).toBe(expected);
110
110
  });
111
111
 
112
112
  it("should render maximum when exclusiveMaximum is false", () => {
113
- const expected = "**Possible values:** value 40";
113
+ const expected = "**Possible values:** `<= 40`";
114
114
  const actual = getQualifierMessage({
115
115
  maximum: 40,
116
116
  exclusiveMaximum: false,
@@ -119,13 +119,13 @@ describe("getQualifierMessage", () => {
119
119
  });
120
120
 
121
121
  it("should render minimum and maximum", () => {
122
- const expected = "**Possible values:** 1 value 40";
122
+ const expected = "**Possible values:** `>= 1` and `<= 40`";
123
123
  const actual = getQualifierMessage({ minimum: 1, maximum: 40 });
124
124
  expect(actual).toBe(expected);
125
125
  });
126
126
 
127
127
  it("should render boolean exclusiveMinimum and maximum", () => {
128
- const expected = "**Possible values:** 1 < value 40";
128
+ const expected = "**Possible values:** `> 1` and `<= 40`";
129
129
  const actual = getQualifierMessage({
130
130
  minimum: 1,
131
131
  maximum: 40,
@@ -135,7 +135,7 @@ describe("getQualifierMessage", () => {
135
135
  });
136
136
 
137
137
  it("should render minimum and boolean exclusiveMaximum", () => {
138
- const expected = "**Possible values:** 1 value < 40";
138
+ const expected = "**Possible values:** `>= 1` and `< 40`";
139
139
  const actual = getQualifierMessage({
140
140
  minimum: 1,
141
141
  maximum: 40,
@@ -145,7 +145,7 @@ describe("getQualifierMessage", () => {
145
145
  });
146
146
 
147
147
  it("should render numeric exclusiveMinimum and maximum", () => {
148
- const expected = "**Possible values:** 1 < value 40";
148
+ const expected = "**Possible values:** `> 1` and `<= 40`";
149
149
  const actual = getQualifierMessage({
150
150
  exclusiveMinimum: 1,
151
151
  maximum: 40,
@@ -154,7 +154,7 @@ describe("getQualifierMessage", () => {
154
154
  });
155
155
 
156
156
  it("should render minimum and numeric exclusiveMaximum", () => {
157
- const expected = "**Possible values:** 1 value < 40";
157
+ const expected = "**Possible values:** `>= 1` and `< 40`";
158
158
  const actual = getQualifierMessage({
159
159
  minimum: 1,
160
160
  exclusiveMaximum: 40,
@@ -163,7 +163,7 @@ describe("getQualifierMessage", () => {
163
163
  });
164
164
 
165
165
  it("should render numeric exclusiveMinimum and boolean exclusiveMaximum", () => {
166
- const expected = "**Possible values:** 1 < value < 40";
166
+ const expected = "**Possible values:** `> 1` and `< 40`";
167
167
  const actual = getQualifierMessage({
168
168
  exclusiveMinimum: 1,
169
169
  maximum: 40,
@@ -74,13 +74,28 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
74
74
 
75
75
  if (schema.minLength || schema.maxLength) {
76
76
  let lengthQualifier = "";
77
- if (schema.minLength) {
78
- lengthQualifier += `${schema.minLength} ≤ `;
77
+ let minLength;
78
+ let maxLength;
79
+ if (schema.minLength && schema.minLength > 1) {
80
+ minLength = `\`>= ${schema.minLength} characters\``;
81
+ }
82
+ if (schema.minLength && schema.minLength === 1) {
83
+ minLength = `\`non-empty\``;
79
84
  }
80
- lengthQualifier += "length";
81
85
  if (schema.maxLength) {
82
- lengthQualifier += ` ${schema.maxLength}`;
86
+ maxLength = `\`<= ${schema.maxLength} characters\``;
87
+ }
88
+
89
+ if (minLength && !maxLength) {
90
+ lengthQualifier += minLength;
83
91
  }
92
+ if (maxLength && !minLength) {
93
+ lengthQualifier += maxLength;
94
+ }
95
+ if (minLength && maxLength) {
96
+ lengthQualifier += `${minLength} and ${maxLength}`;
97
+ }
98
+
84
99
  qualifierGroups.push(lengthQualifier);
85
100
  }
86
101
 
@@ -91,21 +106,33 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
91
106
  typeof schema.exclusiveMaximum === "number"
92
107
  ) {
93
108
  let minmaxQualifier = "";
109
+ let minimum;
110
+ let maximum;
94
111
  if (typeof schema.exclusiveMinimum === "number") {
95
- minmaxQualifier += `${schema.exclusiveMinimum} < `;
112
+ minimum = `\`> ${schema.exclusiveMinimum}\``;
96
113
  } else if (schema.minimum && !schema.exclusiveMinimum) {
97
- minmaxQualifier += `${schema.minimum} ≤ `;
114
+ minimum = `\`>= ${schema.minimum}\``;
98
115
  } else if (schema.minimum && schema.exclusiveMinimum === true) {
99
- minmaxQualifier += `${schema.minimum} < `;
116
+ minimum = `\`> ${schema.minimum}\``;
100
117
  }
101
- minmaxQualifier += "value";
102
118
  if (typeof schema.exclusiveMaximum === "number") {
103
- minmaxQualifier += ` < ${schema.exclusiveMaximum}`;
119
+ maximum = `\`< ${schema.exclusiveMaximum}\``;
104
120
  } else if (schema.maximum && !schema.exclusiveMaximum) {
105
- minmaxQualifier += ` ${schema.maximum}`;
121
+ maximum = `\`<= ${schema.maximum}\``;
106
122
  } else if (schema.maximum && schema.exclusiveMaximum === true) {
107
- minmaxQualifier += ` < ${schema.maximum}`;
123
+ maximum = `\`< ${schema.maximum}\``;
108
124
  }
125
+
126
+ if (minimum && !maximum) {
127
+ minmaxQualifier += minimum;
128
+ }
129
+ if (maximum && !minimum) {
130
+ minmaxQualifier += maximum;
131
+ }
132
+ if (minimum && maximum) {
133
+ minmaxQualifier += `${minimum} and ${maximum}`;
134
+ }
135
+
109
136
  qualifierGroups.push(minmaxQualifier);
110
137
  }
111
138
 
@@ -127,11 +154,11 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
127
154
  }
128
155
 
129
156
  if (schema.minItems) {
130
- qualifierGroups.push(`items >= ${schema.minItems}`);
157
+ qualifierGroups.push(`\`>= ${schema.minItems}\``);
131
158
  }
132
159
 
133
160
  if (schema.maxItems) {
134
- qualifierGroups.push(`items <= ${schema.maxItems}`);
161
+ qualifierGroups.push(`\`<= ${schema.maxItems}\``);
135
162
  }
136
163
 
137
164
  if (qualifierGroups.length === 0) {
@@ -13,7 +13,8 @@ import sdk from "@paloaltonetworks/postman-collection";
13
13
  import Collection from "@paloaltonetworks/postman-collection";
14
14
  import chalk from "chalk";
15
15
  import fs from "fs-extra";
16
- import { kebabCase } from "lodash";
16
+ import cloneDeep from "lodash/cloneDeep";
17
+ import kebabCase from "lodash/kebabCase";
17
18
 
18
19
  import { isURL } from "../index";
19
20
  import {
@@ -54,7 +55,7 @@ async function createPostmanCollection(
54
55
  openapiData: OpenApiObject
55
56
  ): Promise<Collection> {
56
57
  // Create copy of openapiData
57
- const data = Object.assign({}, openapiData) as OpenApiObject;
58
+ const data = cloneDeep(openapiData) as OpenApiObject;
58
59
 
59
60
  // Including `servers` breaks postman, so delete all of them.
60
61
  delete data.servers;
@@ -102,7 +103,6 @@ function createItems(
102
103
  unversionedId: tagId,
103
104
  title: description ?? "",
104
105
  description: description ?? "",
105
- slug: "/" + tagId,
106
106
  frontMatter: {},
107
107
  tag: {
108
108
  ...tag,
@@ -120,7 +120,6 @@ function createItems(
120
120
  unversionedId: infoId,
121
121
  title: openapiData.info.title,
122
122
  description: openapiData.info.description,
123
- slug: "/" + infoId,
124
123
  frontMatter: {},
125
124
  securitySchemes: openapiData.components?.securitySchemes,
126
125
  info: {
@@ -184,7 +183,6 @@ function createItems(
184
183
  unversionedId: baseId,
185
184
  title: title,
186
185
  description: description ?? "",
187
- slug: "/" + baseId,
188
186
  frontMatter: {},
189
187
  api: {
190
188
  ...defaults,
@@ -5,6 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
+ import path from "path";
9
+
8
10
  import {
9
11
  ProcessedSidebar,
10
12
  SidebarItemCategory,
@@ -139,8 +141,8 @@ function groupByTags(
139
141
  type: "generated-index" as "generated-index",
140
142
  title: tag,
141
143
  slug: label
142
- ? "/category/" + kebabCase(label) + "/" + kebabCase(tag)
143
- : "/category/" + kebabCase(tag),
144
+ ? path.join("/category", basePath, kebabCase(label), kebabCase(tag))
145
+ : path.join("/category", basePath, kebabCase(tag)),
144
146
  } as SidebarItemCategoryLinkConfig;
145
147
  }
146
148
 
package/src/types.ts CHANGED
@@ -76,7 +76,7 @@ export interface ApiMetadataBase {
76
76
  description: string;
77
77
  source: string; // @site aliased source => "@site/docs/folder/subFolder/subSubFolder/myDoc.md"
78
78
  sourceDirName: string; // relative to the versioned docs folder (can be ".") => "folder/subFolder/subSubFolder"
79
- slug: string;
79
+ slug?: string;
80
80
  permalink: string;
81
81
  sidebarPosition?: number;
82
82
  frontMatter: Record<string, unknown>;