Added an OpenAPI validation target and license headers.

This commit is contained in:
javier committed 2026-10-25 18:21:23 +01:00
1 parent 2d86dff608
commit 2cfacd0e14
8 files changed
+79 -9

No files matched your search

+10
View File
@@ -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 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" @jq --from-file Scripts/patch-oas.jq "$(OAS_DOWNLOAD_OUTPUT)" > "$(OAS_DOWNLOAD_OUTPUT).tmp"
@mv "$(OAS_DOWNLOAD_OUTPUT).tmp" "$(OAS_DOWNLOAD_OUTPUT)" @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 oas-generate: ## Generates the library source code from the OpenAPI specification document
@mkdir -p "$(OAS_GENERATE_OUTPUT)" @mkdir -p "$(OAS_GENERATE_OUTPUT)"
+6 -4
View File
@@ -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 // This source file is part of the ASConnectService open source project
// //
// Copyright (c) 2026 Röck+Cöde VoF. and the ASConnectService project authors // 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 LICENSE for license information
// See CONTRIBUTORS for the list of ASConnectService project authors // See CONTRIBUTORS for the list of ASConnectService project authors
// //
//===----------------------------------------------------------------------=== // SPDX-License-Identifier: Apache-2.0
//
// ===----------------------------------------------------------------------===
import class Foundation.ProcessInfo import class Foundation.ProcessInfo
import PackageDescription import PackageDescription
+4 -1
View File
@@ -12,7 +12,7 @@ Add `ASConnectService` as a dependency in your `Package.swift` file:
```swift ```swift
dependencies: [ 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 # Regenerate the code only
make oas-generate make oas-generate
# Validate the specification only
make oas-validate
``` ```
## Dependencies ## Dependencies
@@ -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 import Testing
// A non-testable import ensures that the extension can be used from outside the module. // A non-testable import ensures that the extension can be used from outside the module.
@@ -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 Foundation
import HTTPTypes import HTTPTypes
import OpenAPIRuntime import OpenAPIRuntime
@@ -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 Foundation
import HTTPTypes import HTTPTypes
import OpenAPIRuntime import OpenAPIRuntime
@@ -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) #if canImport(CryptoKit)
import CryptoKit import CryptoKit
import Foundation import Foundation
@@ -96,9 +110,8 @@ private extension APIKeyTokenProviderTests {
try #require(parts.count == 3) try #require(parts.count == 3)
let header = try JSONDecoder().decode([String: String].self, from: try #require(Data(base64URL: parts[0]))) let header = try JSONDecoder().decode([String: String].self, from: try #require(Data(base64URL: parts[0])))
let payload = try #require( let payloadData = try #require(Data(base64URL: parts[1]))
try JSONSerialization.jsonObject(with: try #require(Data(base64URL: parts[1]))) as? [String: Any] let payload = try #require(try JSONSerialization.jsonObject(with: payloadData) as? [String: Any])
)
return (header, payload) return (header, payload)
} }
+1 -1
View File
@@ -1,4 +1,4 @@
// swift-tools-version: 5.10 // swift-tools-version: 6.0
// ===----------------------------------------------------------------------=== // ===----------------------------------------------------------------------===
// //