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