diff --git a/Makefile b/Makefile index d390bb16b8..9b39355a2a 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,16 @@ oas-download: ## Downloads the latest App Store Connect OpenAPI specification do oas-patch: # Patches the OpenAPI specification document with the patches in 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)" + @$(MAKE) --no-print-directory oas-validate + +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)" diff --git a/Package.swift b/Package.swift index 387b20cc36..90585d1fb3 100644 --- a/Package.swift +++ b/Package.swift @@ -1,16 +1,18 @@ -// swift-tools-version: 5.10 +// swift-tools-version: 6.0 -//===----------------------------------------------------------------------=== +// ===----------------------------------------------------------------------=== // // This source file is part of the ASConnectService open source project // // Copyright (c) 2026 Röck+Cöde VoF. and the ASConnectService project authors -// Licensed under the EUPL 1.2 or later. +// Licensed under Apache license v2.0 // // See LICENSE for license information // See CONTRIBUTORS for the list of ASConnectService project authors // -//===----------------------------------------------------------------------=== +// SPDX-License-Identifier: Apache-2.0 +// +// ===----------------------------------------------------------------------=== import class Foundation.ProcessInfo import PackageDescription diff --git a/README.md b/README.md index fc94c9795f..163903f59e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Add `ASConnectService` as a dependency in your `Package.swift` file: ```swift dependencies: [ - .package(url: "https://github.com/rock-n-code/asconnect-service.git", from: "1.0.0") + .package(url: "https://github.com/rock-n-code/asconnect-service.git", from: "2.0.0") ] ``` @@ -142,6 +142,9 @@ make oas-download # Regenerate the code only make oas-generate + +# Validate the specification only +make oas-validate ``` ## Dependencies diff --git a/Tests/ASConnectService/Cases/Public/Extensions/PagedDocumentLinksTests.swift b/Tests/ASConnectService/Cases/Public/Extensions/PagedDocumentLinksTests.swift index 79ca6b4e23..3d0ca05324 100644 --- a/Tests/ASConnectService/Cases/Public/Extensions/PagedDocumentLinksTests.swift +++ b/Tests/ASConnectService/Cases/Public/Extensions/PagedDocumentLinksTests.swift @@ -1,3 +1,17 @@ +// ===----------------------------------------------------------------------=== +// +// This source file is part of the ASConnectService open source project +// +// Copyright (c) 2026 Röck+Cöde VoF. and the ASConnectService project authors +// Licensed under Apache license v2.0 +// +// See LICENSE for license information +// See CONTRIBUTORS for the list of ASConnectService project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +// ===----------------------------------------------------------------------=== + import Testing // A non-testable import ensures that the extension can be used from outside the module. diff --git a/Tests/ASConnectService/Cases/Public/Middlewares/BearerAuthMiddlewareTests.swift b/Tests/ASConnectService/Cases/Public/Middlewares/BearerAuthMiddlewareTests.swift index 71e94bfd06..64bf01cb9e 100644 --- a/Tests/ASConnectService/Cases/Public/Middlewares/BearerAuthMiddlewareTests.swift +++ b/Tests/ASConnectService/Cases/Public/Middlewares/BearerAuthMiddlewareTests.swift @@ -1,3 +1,17 @@ +// ===----------------------------------------------------------------------=== +// +// This source file is part of the ASConnectService open source project +// +// Copyright (c) 2026 Röck+Cöde VoF. and the ASConnectService project authors +// Licensed under Apache license v2.0 +// +// See LICENSE for license information +// See CONTRIBUTORS for the list of ASConnectService project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +// ===----------------------------------------------------------------------=== + import Foundation import HTTPTypes import OpenAPIRuntime diff --git a/Tests/ASConnectService/Cases/Public/Middlewares/RateLimitMiddlewareTests.swift b/Tests/ASConnectService/Cases/Public/Middlewares/RateLimitMiddlewareTests.swift index bee86db761..6386ee4fe9 100644 --- a/Tests/ASConnectService/Cases/Public/Middlewares/RateLimitMiddlewareTests.swift +++ b/Tests/ASConnectService/Cases/Public/Middlewares/RateLimitMiddlewareTests.swift @@ -1,3 +1,17 @@ +// ===----------------------------------------------------------------------=== +// +// This source file is part of the ASConnectService open source project +// +// Copyright (c) 2026 Röck+Cöde VoF. and the ASConnectService project authors +// Licensed under Apache license v2.0 +// +// See LICENSE for license information +// See CONTRIBUTORS for the list of ASConnectService project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +// ===----------------------------------------------------------------------=== + import Foundation import HTTPTypes import OpenAPIRuntime diff --git a/Tests/ASConnectService/Cases/Public/Providers/APIKeyTokenProviderTests.swift b/Tests/ASConnectService/Cases/Public/Providers/APIKeyTokenProviderTests.swift index 6d537d7845..e1f85268b7 100644 --- a/Tests/ASConnectService/Cases/Public/Providers/APIKeyTokenProviderTests.swift +++ b/Tests/ASConnectService/Cases/Public/Providers/APIKeyTokenProviderTests.swift @@ -1,3 +1,17 @@ +// ===----------------------------------------------------------------------=== +// +// This source file is part of the ASConnectService open source project +// +// Copyright (c) 2026 Röck+Cöde VoF. and the ASConnectService project authors +// Licensed under Apache license v2.0 +// +// See LICENSE for license information +// See CONTRIBUTORS for the list of ASConnectService project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +// ===----------------------------------------------------------------------=== + #if canImport(CryptoKit) import CryptoKit import Foundation @@ -96,9 +110,8 @@ private extension APIKeyTokenProviderTests { try #require(parts.count == 3) let header = try JSONDecoder().decode([String: String].self, from: try #require(Data(base64URL: parts[0]))) - let payload = try #require( - try JSONSerialization.jsonObject(with: try #require(Data(base64URL: parts[1]))) as? [String: Any] - ) + let payloadData = try #require(Data(base64URL: parts[1])) + let payload = try #require(try JSONSerialization.jsonObject(with: payloadData) as? [String: Any]) return (header, payload) } diff --git a/Tools/Package.swift b/Tools/Package.swift index 1fe008d3d1..6688178f21 100644 --- a/Tools/Package.swift +++ b/Tools/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.10 +// swift-tools-version: 6.0 // ===----------------------------------------------------------------------=== //