Implemented the "oas-patch" target on the Makefile to strip empty enums from the OAS, and validate the document.

This commit is contained in:
javier committed 2026-09-29 00:45:50 +02:00
1 parent d4093472fc
commit d6fff3f64d
1 file changed
+7
+7
View File
@@ -96,6 +96,13 @@ oas-download: ## Downloads the latest App Store Connect OpenAPI specification do
@unzip -q "$(OAS_DOWNLOAD_INPUT)" -d "$(OAS_DOWNLOAD_FOLDER)" @unzip -q "$(OAS_DOWNLOAD_INPUT)" -d "$(OAS_DOWNLOAD_FOLDER)"
@mv "$(OAS_DOWNLOAD_FILE)" "$(OAS_DOWNLOAD_OUTPUT)" @mv "$(OAS_DOWNLOAD_FILE)" "$(OAS_DOWNLOAD_OUTPUT)"
@rm -rf "$(OAS_DOWNLOAD_FOLDER)" @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 # IDE