UNPKG

@autorest/openapi-to-typespec

Version:

Autorest plugin to scaffold a Typespec definition from an OpenAPI document

16 lines (14 loc) 499 B
import { CodeModel } from "@autorest/codemodel"; import { isResponseSchema } from "./schemas"; export function markErrorModels(codeModel: CodeModel) { for (const operationGroup of codeModel.operationGroups) { for (const operation of operationGroup.operations) { const exceptions = operation.exceptions ?? []; for (const exception of exceptions) { if (isResponseSchema(exception)) { exception.schema.language.default.isError = true; } } } } }