1
0
mirror of synced 2026-01-07 00:01:39 -05:00

Add languages enum for rest params (#43667)

Co-authored-by: Rachael Sewell <rachmari@github.com>
This commit is contained in:
Grace Park
2023-10-04 10:01:30 -07:00
committed by GitHub
parent 04884c0d05
commit cbf8079420

View File

@@ -116,6 +116,14 @@ export async function getBodyParams(schema, topLevel = false) {
if (arrayType === 'object') {
childParamsGroups.push(...(await getBodyParams(param.items, false)))
}
// If the type is an enumerated list of strings
if (arrayType === 'string' && param.items.enum) {
param.description += `${
param.description ? '\n' : ''
}Supported values are: ${param.items.enum
.map((lang) => `<code>${lang}</code>`)
.join(', ')}`
}
}
} else if (paramType && paramType.includes('object')) {
if (param && param.oneOf) {
@@ -187,7 +195,6 @@ export async function getBodyParams(schema, topLevel = false) {
childParamsGroups,
topLevel,
})
bodyParametersParsed.push(paramDecorated)
}
return bodyParametersParsed