Overhauled the library with several new features (#5)
## Summary Updates the library to v4.5.1 of the App Store Connect API, and ships it as a breaking 2.0.0 release with pagination, API key authentication, rate limiting, and a lighter install for consumers. ## Breaking changes - **Minimum platforms:** iOS 14, macOS 11, tvOS 14, watchOS 7, and visionOS 1. - **Toolchain:** Swift 6.0+ (Xcode 16+). The package builds in the Swift 6 language mode. - **Runtime:** requires `swift-openapi-runtime` 1.11.0 or later. ## Changes - **API:** updated the OpenAPI specification to v4.5.1, covering 1,303 operations and 1,473 schemas. - **Pagination:** the spec patch adds the undocumented `cursor` query parameter to the 465 paged operations. `PagedDocumentLinks.nextCursor` reads the cursor from a page, and `PagedSequence` iterates every page. - **Authentication:** `APIKeyTokenProvider` signs ES256 tokens from an API key and reuses each one until a minute before it expires. `BearerAuthMiddleware` now accepts a token provider. - **Rate limiting:** `RateLimitMiddleware` retries `429` responses, waiting for `Retry-After` or backing off exponentially. - **Generated code:** committed to `Sources/ASConnectService/Sources/Public/Generated` instead of generated by a build plugin. Consumers now resolve 4 packages instead of 12, and Xcode no longer asks to trust a plugin. - **Tooling:** - `make oas-download` now downloads, patches, generates, and checks the docs in one go. - New `make oas-generate`, `make oas-validate`, and `make doc-check` targets. - The generator is pinned in `Tools/`, and the DocC plugin is only resolved by the documentation targets. - **Documentation:** the DocC catalog now lists every operation and schema in the spec, and the catalog and README are rewritten for the new APIs. - **Housekeeping:** Apache 2.0 license headers on every Swift file, including `Package.swift` and the tests. Reviewed-on: #5 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #5.
This commit is contained in:
1 parent
3aaf5cd7a5
commit
0431fb5133
27 files changed
+1046471
-284
No files matched your search
@@ -19,6 +19,11 @@ environment ?= .env
|
||||
include $(environment)
|
||||
export $(shell sed 's/=.*//' $(environment))
|
||||
|
||||
# Uses the DocC executable from Xcode's default toolchain, as some Swift toolchains (e.g. 6.4.0) ship an x86_64-only one.
|
||||
DOCC_EXEC ?= $(shell xcrun --toolchain com.apple.dt.toolchain.XcodeDefault --find docc 2>/dev/null)
|
||||
|
||||
export DOCC_EXEC
|
||||
|
||||
# LIBRARY
|
||||
|
||||
lib-build: ## Builds the library
|
||||
@@ -57,7 +62,7 @@ pkg-update: ## Updates the SPM package dependencies
|
||||
doc-generate: doc-generate-archive doc-generate-github ## Generates the library documentation for both Github and Xcode
|
||||
|
||||
doc-generate-archive: ## Generates the library documentation archive for Xcode
|
||||
@swift package \
|
||||
@ENABLE_DOCC_PLUGIN=1 swift package \
|
||||
--allow-writing-to-directory $(DOCC_ARCHIVE_OUTPUT) \
|
||||
generate-documentation \
|
||||
--target $(SPM_LIBRARY_TARGET) \
|
||||
@@ -66,7 +71,7 @@ doc-generate-archive: ## Generates the library documentation archive for Xcode
|
||||
--output-path $(DOCC_ARCHIVE_OUTPUT)
|
||||
|
||||
doc-generate-github: ## Generates the library documentation for Github
|
||||
@swift package \
|
||||
@ENABLE_DOCC_PLUGIN=1 swift package \
|
||||
--allow-writing-to-directory $(DOCC_GITHUB_OUTPUT) \
|
||||
generate-documentation \
|
||||
--target $(SPM_LIBRARY_TARGET) \
|
||||
@@ -77,9 +82,12 @@ doc-generate-github: ## Generates the library documentation for Github
|
||||
--hosting-base-path $(DOCC_GITHUB_BASE_PATH) \
|
||||
--output-path $(DOCC_GITHUB_OUTPUT)
|
||||
|
||||
doc-check: ## Checks the DocC catalog covers every generated operation and schema
|
||||
@python3 -I Scripts/check-docc.py "$(OAS_GENERATE_OUTPUT)" "$(DOCC_CATALOG)"
|
||||
|
||||
doc-preview: ## Previews the library documentation in Safari
|
||||
@open -a safari $(DOCC_PREVIEW_URL)
|
||||
@swift package \
|
||||
@ENABLE_DOCC_PLUGIN=1 swift package \
|
||||
--disable-sandbox \
|
||||
preview-documentation \
|
||||
--target $(SPM_LIBRARY_TARGET) \
|
||||
@@ -96,6 +104,35 @@ 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)"
|
||||
@# Generating the code also validates the document.
|
||||
@$(MAKE) --no-print-directory oas-patch-document
|
||||
@$(MAKE) --no-print-directory oas-generate
|
||||
@$(MAKE) --no-print-directory doc-check
|
||||
|
||||
oas-patch: oas-patch-document oas-validate # Patches and validates the OpenAPI specification document
|
||||
|
||||
oas-patch-document: # Patches the OpenAPI specification document with Scripts/patch-oas.jq
|
||||
@jq --from-file Scripts/patch-oas.jq "$(OAS_DOWNLOAD_OUTPUT)" > "$(OAS_DOWNLOAD_OUTPUT).tmp"
|
||||
@mv "$(OAS_DOWNLOAD_OUTPUT).tmp" "$(OAS_DOWNLOAD_OUTPUT)"
|
||||
|
||||
oas-validate: ## Validates the OpenAPI specification document
|
||||
@swift run \
|
||||
--configuration release \
|
||||
--package-path "$(OAS_GENERATE_TOOLS)" \
|
||||
swift-openapi-generator generate \
|
||||
--config "$(OAS_GENERATE_CONFIG)" \
|
||||
--dry-run \
|
||||
"$(OAS_DOWNLOAD_OUTPUT)"
|
||||
|
||||
oas-generate: ## Generates the library source code from the OpenAPI specification document
|
||||
@mkdir -p "$(OAS_GENERATE_OUTPUT)"
|
||||
@swift run \
|
||||
--configuration release \
|
||||
--package-path "$(OAS_GENERATE_TOOLS)" \
|
||||
swift-openapi-generator generate \
|
||||
--config "$(OAS_GENERATE_CONFIG)" \
|
||||
--output-directory "$(OAS_GENERATE_OUTPUT)" \
|
||||
"$(OAS_DOWNLOAD_OUTPUT)"
|
||||
|
||||
# IDE
|
||||
|
||||
|
||||
Reference in new issue
Block a user