docs-util: sort examples to show JS SDK first (#11986)
This commit is contained in:
@@ -363,13 +363,6 @@ class OasKindGenerator extends FunctionKindGenerator {
|
|||||||
// retrieve code examples
|
// retrieve code examples
|
||||||
oas["x-codeSamples"] = []
|
oas["x-codeSamples"] = []
|
||||||
|
|
||||||
if (curlExample) {
|
|
||||||
oas["x-codeSamples"].push({
|
|
||||||
...OasExamplesGenerator.CURL_CODESAMPLE_DATA,
|
|
||||||
source: curlExample,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsSdkExample) {
|
if (jsSdkExample) {
|
||||||
oas["x-codeSamples"].push({
|
oas["x-codeSamples"].push({
|
||||||
...OasExamplesGenerator.JSCLIENT_CODESAMPLE_DATA,
|
...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
|
// add security details if applicable
|
||||||
oas.security = this.getSecurity({
|
oas.security = this.getSecurity({
|
||||||
isAdminAuthenticated,
|
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
|
// push new tags to the tags property
|
||||||
if (tagName) {
|
if (tagName) {
|
||||||
const areaTags = this.tags.get(splitOasPath[0] as OasArea)
|
const areaTags = this.tags.get(splitOasPath[0] as OasArea)
|
||||||
|
|||||||
Reference in New Issue
Block a user