docusaurus-plugin-openapi-docs 0.0.0-1007 → 0.0.0-1008
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.
- package/lib/openapi/openapi.js +16 -0
- package/lib/openapi/types.d.ts +1 -0
- package/lib/openapi/utils/types.d.ts +1 -0
- package/lib/types.d.ts +1 -0
- package/package.json +2 -2
- package/src/openapi/openapi.ts +17 -0
- package/src/openapi/types.ts +1 -1
- package/src/openapi/utils/types.ts +1 -0
- package/src/types.ts +1 -0
package/lib/openapi/openapi.js
CHANGED
|
@@ -211,6 +211,7 @@ function createItems(openapiData, options, sidebarOptions) {
|
|
|
211
211
|
jsonRequestBodyExample,
|
|
212
212
|
info: openapiData.info,
|
|
213
213
|
},
|
|
214
|
+
position: operationObject["x-position"],
|
|
214
215
|
};
|
|
215
216
|
items.push(apiPage);
|
|
216
217
|
}
|
|
@@ -406,6 +407,21 @@ function createItems(openapiData, options, sidebarOptions) {
|
|
|
406
407
|
items.push(tagPage);
|
|
407
408
|
});
|
|
408
409
|
}
|
|
410
|
+
items.sort((a, b) => {
|
|
411
|
+
// Items with position come first, sorted by position
|
|
412
|
+
if (a.position !== undefined && b.position !== undefined) {
|
|
413
|
+
return a.position - b.position;
|
|
414
|
+
}
|
|
415
|
+
// Items with position come before items without position
|
|
416
|
+
if (a.position !== undefined) {
|
|
417
|
+
return -1;
|
|
418
|
+
}
|
|
419
|
+
if (b.position !== undefined) {
|
|
420
|
+
return 1;
|
|
421
|
+
}
|
|
422
|
+
// If neither has position, maintain original order
|
|
423
|
+
return 0;
|
|
424
|
+
});
|
|
409
425
|
return items;
|
|
410
426
|
}
|
|
411
427
|
/**
|
package/lib/openapi/types.d.ts
CHANGED
|
@@ -128,6 +128,7 @@ export interface OperationObject {
|
|
|
128
128
|
deprecated?: boolean;
|
|
129
129
|
security?: SecurityRequirementObject[];
|
|
130
130
|
servers?: ServerObject[];
|
|
131
|
+
"x-position"?: number;
|
|
131
132
|
"x-deprecated-description"?: string;
|
|
132
133
|
}
|
|
133
134
|
export interface OperationObjectWithRef {
|
package/lib/types.d.ts
CHANGED
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-
|
|
4
|
+
"version": "0.0.0-1008",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=14"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "d50a1409c5b6097064616bac66c5a079431c61de"
|
|
69
69
|
}
|
package/src/openapi/openapi.ts
CHANGED
|
@@ -263,6 +263,7 @@ function createItems(
|
|
|
263
263
|
jsonRequestBodyExample,
|
|
264
264
|
info: openapiData.info,
|
|
265
265
|
},
|
|
266
|
+
position: operationObject["x-position"] as number | undefined,
|
|
266
267
|
};
|
|
267
268
|
|
|
268
269
|
items.push(apiPage);
|
|
@@ -509,6 +510,22 @@ function createItems(
|
|
|
509
510
|
});
|
|
510
511
|
}
|
|
511
512
|
|
|
513
|
+
items.sort((a, b) => {
|
|
514
|
+
// Items with position come first, sorted by position
|
|
515
|
+
if (a.position !== undefined && b.position !== undefined) {
|
|
516
|
+
return a.position - b.position;
|
|
517
|
+
}
|
|
518
|
+
// Items with position come before items without position
|
|
519
|
+
if (a.position !== undefined) {
|
|
520
|
+
return -1;
|
|
521
|
+
}
|
|
522
|
+
if (b.position !== undefined) {
|
|
523
|
+
return 1;
|
|
524
|
+
}
|
|
525
|
+
// If neither has position, maintain original order
|
|
526
|
+
return 0;
|
|
527
|
+
});
|
|
528
|
+
|
|
512
529
|
return items as ApiMetadata[];
|
|
513
530
|
}
|
|
514
531
|
|
package/src/openapi/types.ts
CHANGED