diff --git a/www/utils/packages/docs-generator/src/classes/kinds/oas.ts b/www/utils/packages/docs-generator/src/classes/kinds/oas.ts index da910c8ae4..2ce5fd75ba 100644 --- a/www/utils/packages/docs-generator/src/classes/kinds/oas.ts +++ b/www/utils/packages/docs-generator/src/classes/kinds/oas.ts @@ -363,13 +363,6 @@ class OasKindGenerator extends FunctionKindGenerator { // retrieve code examples oas["x-codeSamples"] = [] - if (curlExample) { - oas["x-codeSamples"].push({ - ...OasExamplesGenerator.CURL_CODESAMPLE_DATA, - source: curlExample, - }) - } - if (jsSdkExample) { oas["x-codeSamples"].push({ ...OasExamplesGenerator.JSCLIENT_CODESAMPLE_DATA, @@ -377,6 +370,13 @@ class OasKindGenerator extends FunctionKindGenerator { }) } + if (curlExample) { + oas["x-codeSamples"].push({ + ...OasExamplesGenerator.CURL_CODESAMPLE_DATA, + source: curlExample, + }) + } + // add security details if applicable oas.security = this.getSecurity({ isAdminAuthenticated, @@ -729,6 +729,13 @@ class OasKindGenerator extends FunctionKindGenerator { ) } + // sort the code samples to show JS SDK first + oas["x-codeSamples"] = oas["x-codeSamples"]?.sort((a) => { + return a.label === OasExamplesGenerator.JSCLIENT_CODESAMPLE_DATA.label + ? -1 + : 1 + }) + // push new tags to the tags property if (tagName) { const areaTags = this.tags.get(splitOasPath[0] as OasArea)