From d6fff3f64d4d7f12c1e1d410adf22145ca96b099 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 29 Sep 2026 00:45:50 +0200 Subject: [PATCH] Implemented the "oas-patch" target on the Makefile to strip empty enums from the OAS, and validate the document. --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 22b22a576b..5138766f5f 100644 --- a/Makefile +++ b/Makefile @@ -96,6 +96,13 @@ oas-download: ## Downloads the latest App Store Connect OpenAPI specification do @unzip -q "$(OAS_DOWNLOAD_INPUT)" -d "$(OAS_DOWNLOAD_FOLDER)" @mv "$(OAS_DOWNLOAD_FILE)" "$(OAS_DOWNLOAD_OUTPUT)" @rm -rf "$(OAS_DOWNLOAD_FOLDER)" + @$(MAKE) --no-print-directory oas-patch + +oas-patch: # Patches the OpenAPI specification document so the generated code compiles + @# Removes empty enums (e.g. `fields[appKeywords]`), as they generate case-less Swift enums that do not compile. + @jq '(.. | objects | select(.enum == [])) |= del(.enum)' \ + "$(OAS_DOWNLOAD_OUTPUT)" > "$(OAS_DOWNLOAD_OUTPUT).tmp" + @mv "$(OAS_DOWNLOAD_OUTPUT).tmp" "$(OAS_DOWNLOAD_OUTPUT)" # IDE