From ff317759b4eed5326f97d57d881b2c23169ca681 Mon Sep 17 00:00:00 2001 From: Miki Palet <64255955+mikipalet@users.noreply.github.com> Date: Fri, 11 Sep 2026 17:29:55 +0000 Subject: [PATCH] fix: feed the generator JSON, the spec outgrew SnakeYAML's code point limit swagger-parser rejects YAML over 3,145,728 code points, so every regen has failed at parse since 2026-09-09 18:17 UTC. Emit the normalized spec as JSON. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_011xXCyV3bWuwGP6t6RkcVVv --- .github/workflows/generate.yml | 4 ++-- scripts/normalize-spec-for-java.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 1da683b0687..9d824a128db 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -48,12 +48,12 @@ jobs: - name: Normalize spec for the Java generator run: | python3 -c 'import yaml' 2>/dev/null || python3 -m pip install --quiet --break-system-packages pyyaml - python3 scripts/normalize-spec-for-java.py openapi.yaml "$RUNNER_TEMP/openapi-java.yaml" + python3 scripts/normalize-spec-for-java.py openapi.yaml "$RUNNER_TEMP/openapi-java.json" - name: Generate SDK run: | openapi-generator-cli generate \ - -i "$RUNNER_TEMP/openapi-java.yaml" \ + -i "$RUNNER_TEMP/openapi-java.json" \ -g java \ -o . \ --skip-validate-spec \ diff --git a/scripts/normalize-spec-for-java.py b/scripts/normalize-spec-for-java.py index 820285b33ee..577f1146ed0 100755 --- a/scripts/normalize-spec-for-java.py +++ b/scripts/normalize-spec-for-java.py @@ -11,6 +11,7 @@ still deserializes into the right runtime shape) instead of failing the build. """ +import json import sys import yaml @@ -59,8 +60,10 @@ def main(): collapsed = [] collapse_unexpressible_unions(spec, "$", collapsed) + # JSON, not YAML: swagger-parser's SnakeYAML rejects YAML over 3,145,728 + # code points, and the spec outgrew that on 2026-09-09. with open(destination, "w") as out: - yaml.safe_dump(spec, out, sort_keys=False, allow_unicode=True, width=10**9) + json.dump(spec, out, ensure_ascii=False, default=str) for location in collapsed: print(f"collapsed to free-form (unexpressible in Java): {location}")