docusaurus-plugin-openapi-docs 0.0.0-471 → 0.0.0-475

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.
@@ -18,6 +18,7 @@ const chalk_1 = __importDefault(require("chalk"));
18
18
  const fs_extra_1 = __importDefault(require("fs-extra"));
19
19
  const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
20
20
  const kebabCase_1 = __importDefault(require("lodash/kebabCase"));
21
+ const unionBy_1 = __importDefault(require("lodash/unionBy"));
21
22
  const index_1 = require("../index");
22
23
  const createRequestExample_1 = require("./createRequestExample");
23
24
  const loadAndResolveSpec_1 = require("./utils/loadAndResolveSpec");
@@ -151,6 +152,16 @@ function createItems(openapiData, sidebarOptions) {
151
152
  }
152
153
  // TODO: Don't include summary temporarilly
153
154
  const { summary, ...defaults } = operationObject;
155
+ // Merge common parameters with operation parameters
156
+ // Operation params take precendence over common params
157
+ if (parameters !== undefined) {
158
+ if (operationObject.parameters !== undefined) {
159
+ defaults.parameters = (0, unionBy_1.default)(operationObject.parameters, parameters, "name");
160
+ }
161
+ else {
162
+ defaults.parameters = parameters;
163
+ }
164
+ }
154
165
  const apiPage = {
155
166
  type: "api",
156
167
  id: baseId,
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-471",
4
+ "version": "0.0.0-475",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "ffe72bdf41cac5a74fa31074f22c08911fcfa7ae"
71
+ "gitHead": "4ab052860928721c4abc6aacbadeab251c45560f"
72
72
  }
@@ -15,6 +15,7 @@ import chalk from "chalk";
15
15
  import fs from "fs-extra";
16
16
  import cloneDeep from "lodash/cloneDeep";
17
17
  import kebabCase from "lodash/kebabCase";
18
+ import unionBy from "lodash/unionBy";
18
19
 
19
20
  import { isURL } from "../index";
20
21
  import {
@@ -193,6 +194,20 @@ function createItems(
193
194
  // TODO: Don't include summary temporarilly
194
195
  const { summary, ...defaults } = operationObject;
195
196
 
197
+ // Merge common parameters with operation parameters
198
+ // Operation params take precendence over common params
199
+ if (parameters !== undefined) {
200
+ if (operationObject.parameters !== undefined) {
201
+ defaults.parameters = unionBy(
202
+ operationObject.parameters,
203
+ parameters,
204
+ "name"
205
+ );
206
+ } else {
207
+ defaults.parameters = parameters;
208
+ }
209
+ }
210
+
196
211
  const apiPage: PartialPage<ApiPageMetadata> = {
197
212
  type: "api",
198
213
  id: baseId,