Skip to content

Commit 708fb7f

Browse files
committed
chore(openapi-codegen): drop spec post-processing workarounds
Upstream gdc-nas (DX-346) cleaned the OpenAPI spec so the regen pipeline no longer needs local repairs: - Drop the NUL-stripping `tr` after the jq merge — `DeclarativeColumn.name` no longer carries a `^[^NUL]*$` pattern that leaked literal NUL bytes through jq decoding. - Drop the jq cycle-break on `DashboardCompoundComparisonCondition` / `DashboardCompoundRangeCondition` — Springdoc no longer emits the redundant child-to-parent `allOf: [{$ref: ...}]` that crashed openapi-generator-cli v6.6.0 with StackOverflowError in `recursiveGetDiscriminator`. - Drop the `scripts/postprocess_api_client.py` invocation and delete the script — it only existed to repair regex patterns mangled by the now-absent NUL escape. - Repoint `make api-client STAGING=1` from `demo-cicd.cloud.gooddata.com` (production) to `staging.dev-latest.stg11.panther.intgdc.com` (actual staging). The previous URL silently regenerated against production and would re-introduce the workarounds. Verified by regenerating the client against staging with the workarounds removed: no StackOverflowError, no NUL bytes in the merged spec, no mangled regex in the generated Python. JIRA: DX-346 risk: low
1 parent 88138a3 commit 708fb7f

2 files changed

Lines changed: 3 additions & 75 deletions

File tree

Makefile

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ NO_CLIENT_GD_PROJECTS_ABS = $(filter-out %client, $(wildcard $(CURDIR)/packages/
88
NO_CLIENT_GD_PROJECTS_DIRS = $(foreach dir, $(NO_CLIENT_GD_PROJECTS_ABS), $(notdir $(dir)))
99
# TODO: replace API_VERSION in the future by call to API
1010
API_VERSION="v1"
11-
# Default: generate from localhost; use `make api-client STAGING=1` to download from remote
11+
# Default: generate from localhost; use `make api-client STAGING=1` to download from staging
1212
ifdef STAGING
13-
BASE_URL="https://demo-cicd.cloud.gooddata.com"
13+
BASE_URL="https://staging.dev-latest.stg11.panther.intgdc.com"
1414
else
1515
BASE_URL="http://localhost:3000"
1616
endif
@@ -61,22 +61,8 @@ endef
6161
.PHONY: _api-client-generate
6262
_api-client-generate:
6363
rm -f schemas/gooddata-api-client.json
64-
# Merge per-domain specs and strip literal NUL bytes that jq decoded from
65-
# escapes in the source (the previous `sed '/.../d'` pattern was a no-op:
66-
# sed BRE/ERE doesn't interpret \uNNNN, so it never matched anything).
67-
cat schemas/gooddata-*.json | jq -S -s 'reduce .[] as $$item ({}; . * $$item) + { tags : ( reduce .[].tags as $$item (null; . + $$item) | unique_by(.name) ) }' | tr -d '\000' > "schemas/gooddata-api-client.json"
68-
# Break the DashboardCompoundConditionItem ↔ children oneOf/allOf cycle that
69-
# crashes openapi-generator-cli v6.6.0 with StackOverflowError in
70-
# recursiveGetDiscriminator (its walker has no visited-set). Parent has no
71-
# own properties, so dropping the redundant `allOf: [{$$ref: parent}]` from
72-
# each child is semantically a no-op.
73-
jq '(.components.schemas.DashboardCompoundComparisonCondition.allOf) |= map(select(.["$$ref"] != "#/components/schemas/DashboardCompoundConditionItem")) | (.components.schemas.DashboardCompoundRangeCondition.allOf) |= map(select(.["$$ref"] != "#/components/schemas/DashboardCompoundConditionItem"))' schemas/gooddata-api-client.json > schemas/gooddata-api-client.json.tmp && mv schemas/gooddata-api-client.json.tmp schemas/gooddata-api-client.json
64+
cat schemas/gooddata-*.json | jq -S -s 'reduce .[] as $$item ({}; . * $$item) + { tags : ( reduce .[].tags as $$item (null; . + $$item) | unique_by(.name) ) }' > "schemas/gooddata-api-client.json"
7465
$(call generate_client,api)
75-
# Repair regex patterns of the form ^[^\x00]*$ that openapi-generator mangles
76-
# in two ways: sometimes it drops the NUL (leaving the invalid `^[^]*$`),
77-
# sometimes it embeds a literal NUL byte (producing a Python source that
78-
# fails to import with SyntaxError). The helper handles both shapes.
79-
./scripts/postprocess_api_client.py gooddata-api-client/gooddata_api_client
8066

8167
.PHONY: api-client
8268
api-client: download _api-client-generate

scripts/postprocess_api_client.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)