Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.12.4 2026-03-13

- Only throw error on AutoRest stderr when exit code is non-zero; log warnings otherwise

# 0.12.3 2025-10-13

- Fix crash in logging when property named "$ref"
Expand Down
20 changes: 14 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/oad",
"version": "0.12.3",
"version": "0.12.4",
"author": {
"name": "Microsoft Corporation",
"email": "azsdkteam@microsoft.com",
Expand All @@ -15,7 +15,7 @@
"@ts-common/json-parser": "0.9.0",
"@ts-common/source-map": "0.5.0",
"@ts-common/string-map": "0.3.0",
"autorest": "^3.6.1",
"autorest": "^3.8.0",
"js-yaml": "^4.1.0",
"json-pointer": "0.6.2",
"json-refs": "^3.0.15",
Expand Down
19 changes: 13 additions & 6 deletions src/lib/validators/openApiDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,20 @@ export class OpenApiDiff {

log.debug(`Executing: "${autoRestFile} ${args.join(" ")}"`)

const { stderr } = await execFile(autoRestFile, args, {
encoding: "utf8",
maxBuffer: 1024 * 1024 * 64,
env: { ...process.env, NODE_OPTIONS: "--max-old-space-size=8192" }
})
// autorest 3.8.0 emits deprecation message to stderr with exit code 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this part of the change is needed at all. If autorest returns nonzero exit, execFile() throws, and we can just let the error bubble up. We don't need to catch and re-throw.

let stderr: string
try {
const result = await execFile(autoRestFile, args, {
encoding: "utf8",
maxBuffer: 1024 * 1024 * 64,
env: { ...process.env, NODE_OPTIONS: "--max-old-space-size=8192" }
})
stderr = result.stderr
} catch (e) {
throw new Error(util.inspect(e))
}
if (stderr) {
throw new Error(stderr)
log.error(`AutoRest completed with warnings on stderr: ${stderr}`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe log.debug() would be better than log.error()? autorest writing to stderr isn't really an "error", it's more of a "warning" at best.

}

const buffer = await asyncFs.readFile(outputMapFilePath)
Expand Down
Loading