File tree Expand file tree Collapse file tree
packages/docusaurus-plugin-openapi-docs/src/openapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -263,6 +263,7 @@ function createItems(
263263 jsonRequestBodyExample,
264264 info : openapiData . info ,
265265 } ,
266+ position : operationObject [ "x-position" ] as number | undefined ,
266267 } ;
267268
268269 items . push ( apiPage ) ;
@@ -509,6 +510,22 @@ function createItems(
509510 } ) ;
510511 }
511512
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+
512529 return items as ApiMetadata [ ] ;
513530}
514531
You can’t perform that action at this time.
0 commit comments