Skip to content

Commit

Permalink
remove some old logging from openapi script (github#30317)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmari authored Aug 26, 2022
1 parent d977d39 commit a9aa911
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions script/rest/utils/get-body-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ async function getTopLevelOneOfProperty(schema) {
}

// Gets the body parameters for a given schema recursively.
export async function getBodyParams(schema, topLevel = false, summary = '', depth = 1) {
if (summary && depth > 3) console.log(depth, summary)
export async function getBodyParams(schema, topLevel = false) {
const bodyParametersParsed = []
const schemaObject = schema.oneOf && topLevel ? await getTopLevelOneOfProperty(schema) : schema
const properties = schemaObject.properties || {}
Expand Down Expand Up @@ -83,20 +82,18 @@ export async function getBodyParams(schema, topLevel = false, summary = '', dept
default: param.default,
childParamsGroups: [],
}
keyParam.childParamsGroups.push(
...(await getBodyParams(param.additionalProperties, false, summary, depth + 1))
)
keyParam.childParamsGroups.push(...(await getBodyParams(param.additionalProperties, false)))
childParamsGroups.push(keyParam)
} else if (paramType && paramType.includes('array')) {
const arrayType = param.items.type
if (arrayType) {
paramType.splice(paramType.indexOf('array'), 1, `array of ${arrayType}s`)
}
if (arrayType === 'object') {
childParamsGroups.push(...(await getBodyParams(param.items, false, summary, depth + 1)))
childParamsGroups.push(...(await getBodyParams(param.items, false)))
}
} else if (paramType && paramType.includes('object')) {
childParamsGroups.push(...(await getBodyParams(param, false, summary, depth + 1)))
childParamsGroups.push(...(await getBodyParams(param, false)))
} else if (param && param.oneOf) {
// get concatenated description and type
const descriptions = []
Expand Down

0 comments on commit a9aa911

Please sign in to comment.