Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function toModelErrors(
processedErrors: Iterable,
operationId: string,
scenario: string,
source: ValidationResultSource,
responseCode: string
): it.IterableEx {
return it.map(processedErrors, value => {
if (value.code === undefined) {
value.code = "INTERNAL_ERROR"
}
const severity = errorCodeToErrorMetadata(value.code as ExtendedErrorCode).severity
const modelError: ModelValidationError = {
operationId,
scenario,
source,
responseCode,
severity,
code: value.code,
details: value
}
return modelError
})
}
private async resolveExamples(
suppression: Suppression | undefined
): Promise> {
const options = {
relativeBase: this.specDir,
filter: ["relative", "remote"]
}
const allRefsRemoteRelative = JsonRefs.findRefs(this.specInJson as object, options)
const e = entries(allRefsRemoteRelative as StringMap)
const promiseFactories = toArray(
map(e, ([refName, refDetails]) => async () =>
this.resolveRelativeReference(
suppression,
refName,
refDetails,
this.specInJson,
this.specPath
)
)
)
if (promiseFactories.length) {
return utils.executePromisesSequentially(promiseFactories)
} else {
return this.specInJson
}
}