Skip to content

Commit 68e83c0

Browse files
chore(tools): fail generation when the generator warns
A schema it cannot parse is downgraded to a warning: the endpoint or response it belongs to is dropped, the rest is written, and the run exits 0. Nothing downstream can tell that from a client that never had the operation. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014f9oEEYspPH4fmPULTnLkJ
1 parent d704489 commit 68e83c0

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tools/gen_sdk.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,19 @@ if [ "$have" != "$want" ]; then
3232
fi
3333

3434
rm -rf "${REPO:?}/$OUT"
35+
log="$(mktemp)"
36+
trap 'rm -f "$log"' EXIT
3537
(cd "$REPO" && "$VENV/bin/openapi-python-client" generate \
3638
--path "$REPO/specs/docstudio-oss.json" --output-path "$REPO/$OUT" \
37-
--config "$REPO/tools/openapi-client.yaml" --overwrite --meta none)
39+
--config "$REPO/tools/openapi-client.yaml" --overwrite --meta none) 2>&1 | tee "$log"
40+
41+
# The generator downgrades a schema it cannot parse to a warning, drops
42+
# the endpoint or model it belongs to, writes the rest and exits 0. The
43+
# result is a client missing an operation and a spec that still looks fine.
44+
if grep -qi warning "$log"; then
45+
echo "the generator reported a problem above and still exited 0; whatever it could not parse is missing from the output" >&2
46+
exit 1
47+
fi
3848

3949
# Stamp every file, so the rule survives contact with a reader who arrived via
4050
# grep rather than via this script.

0 commit comments

Comments
 (0)