From 50fedd8cf15bcf21232fa6cd15afde49946c8e3d Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Thu, 11 Sep 2025 09:17:28 -0500 Subject: [PATCH 1/6] move to openapikit 4.x --- .github/workflows/tests.yml | 10 ++++++--- Package.resolved | 45 +++++++++++++++---------------------- Package.swift | 7 +++--- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4f21b9a..c5797d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,20 +17,24 @@ jobs: - swift:5.9-jammy - swift:5.10-focal - swift:5.10-jammy + - swift:6.0-focal + - swift:6.0-jammy + - swift:6.1-focal + - swift:6.1-jammy container: ${{ matrix.image }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: Run tests run: swift test osx: - runs-on: macOS-13 + runs-on: macOS-15 steps: - name: Select latest available Xcode uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: Run tests run: swift test diff --git a/Package.resolved b/Package.resolved index ff1391a..75f5325 100644 --- a/Package.resolved +++ b/Package.resolved @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/mattpolzin/JSONAPI.git", "state" : { - "revision" : "661dfc3ffec1ba3a201fd067877da2f3c553f236", - "version" : "5.1.0" + "revision" : "58ebdc9b104383288cde3028ce0efd552e08c47a", + "version" : "5.3.1" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/mattpolzin/OpenAPIKit.git", "state" : { - "revision" : "ae98338a8e660ae547b058ebb69c010e70b64e31", - "version" : "3.0.0" + "revision" : "eae73235dd6a8fb9177a75da929e8bbd637c1285", + "version" : "4.0.1" } }, { @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/mattpolzin/OpenAPIReflection.git", "state" : { - "revision" : "aa9d56c75b913818c513a3b0a2cd716b8443e81e", - "version" : "2.0.0" + "revision" : "d5981296867215f62363d6c88cf05c8d71cf8d48", + "version" : "3.0.0" } }, { @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/mattpolzin/Poly.git", "state" : { - "revision" : "c108e9e0a2904134719b082f6c18d64406afc6db", - "version" : "2.6.0" + "revision" : "99e2e8b575620369be52fe348c0dd72028e3674c", + "version" : "2.8.0" } }, { @@ -77,17 +77,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser.git", "state" : { - "revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531", - "version" : "1.2.3" + "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", + "version" : "1.6.1" } }, { "identity" : "swift-cmark", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-cmark.git", + "location" : "https://github.com/swiftlang/swift-cmark.git", "state" : { - "revision" : "f218e5d7691f78b55bfa39b367763f4612486c35", - "version" : "0.3.0" + "revision" : "b022b08312decdc46585e0b3440d97f6f22ef703", + "version" : "0.6.0" } }, { @@ -104,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-markdown.git", "state" : { - "revision" : "e4f95e2dc23097a1a9a1dfdfe3fe3ee44de77378", - "version" : "0.3.0" + "revision" : "ea79e83c8744d2b50b0dc2d5bbd1e857e1253bf9", + "version" : "0.6.0" } }, { @@ -120,10 +120,10 @@ { "identity" : "swift-syntax", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax", + "location" : "https://github.com/apple/swift-syntax.git", "state" : { - "revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036", - "version" : "509.0.2" + "revision" : "64889f0c732f210a935a0ad7cda38f77f876262d", + "version" : "509.1.1" } }, { @@ -134,15 +134,6 @@ "revision" : "077c096c3ddfc38db223ac8e525ad16ffb987138", "version" : "0.12.0" } - }, - { - "identity" : "yams", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jpsim/Yams.git", - "state" : { - "revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3", - "version" : "5.0.6" - } } ], "version" : 2 diff --git a/Package.swift b/Package.swift index 41fb1e3..1d83c7c 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,8 @@ import PackageDescription let package = Package( name: "JSONAPI-OpenAPI", platforms: [ - .macOS(.v12), + .macOS(.v10_15), + .iOS(.v13), ], products: [ .library( @@ -21,8 +22,8 @@ let package = Package( dependencies: [ .package(url: "https://github.com/mattpolzin/Sampleable.git", from: "2.0.0"), .package(url: "https://github.com/mattpolzin/JSONAPI.git", from: "5.0.0"), - .package(url: "https://github.com/mattpolzin/OpenAPIKit.git", from: "3.0.0"), - .package(url: "https://github.com/mattpolzin/OpenAPIReflection.git", from: "2.0.0"), + .package(url: "https://github.com/mattpolzin/OpenAPIKit.git", from: "4.0.0"), + .package(url: "https://github.com/mattpolzin/OpenAPIReflection.git", from: "3.0.0"), .package(url: "https://github.com/typelift/SwiftCheck.git", .upToNextMinor(from: "0.12.0")), .package(url: "https://github.com/apple/swift-format.git", from: "509.0.0"), .package(url: "https://github.com/pointfreeco/swift-nonempty.git", .upToNextMinor(from: "0.2.0")), From afafee7f7e55bc31df2e97518c5eb9d0e436c475 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sat, 13 Sep 2025 22:22:46 -0500 Subject: [PATCH 2/6] move to JSONAPI v6 --- Package.resolved | 15 ++++++++------- Package.swift | 8 ++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Package.resolved b/Package.resolved index 75f5325..fc0a0ac 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "18b6b3a9c61dea1e158c31a5b1ffef8354cca7a9c2dd0e1ea44111fd49e6aac9", "pins" : [ { "identity" : "chalk", @@ -23,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/mattpolzin/JSONAPI.git", "state" : { - "revision" : "58ebdc9b104383288cde3028ce0efd552e08c47a", - "version" : "5.3.1" + "revision" : "d3457ae21a76b21e9a8f5bf3953ba9166cfa12f0", + "version" : "6.0.0" } }, { @@ -32,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/mattpolzin/JSONAPIViz.git", "state" : { - "revision" : "407422e121c2d73f6dd262071df62481cb4016e9", - "version" : "0.0.6" + "revision" : "129a7d622a8512bd35909b413a4ab7a70ddaac3f", + "version" : "0.0.7" } }, { @@ -59,8 +60,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/mattpolzin/Poly.git", "state" : { - "revision" : "99e2e8b575620369be52fe348c0dd72028e3674c", - "version" : "2.8.0" + "revision" : "37c942daa23ab373ce05ef87f42103342e59cf3a", + "version" : "3.0.0" } }, { @@ -136,5 +137,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/Package.swift b/Package.swift index 1d83c7c..d559349 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.8 +// swift-tools-version:6.0 import PackageDescription @@ -21,13 +21,13 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/mattpolzin/Sampleable.git", from: "2.0.0"), - .package(url: "https://github.com/mattpolzin/JSONAPI.git", from: "5.0.0"), + .package(url: "https://github.com/mattpolzin/JSONAPI.git", from: "6.0.0"), .package(url: "https://github.com/mattpolzin/OpenAPIKit.git", from: "4.0.0"), .package(url: "https://github.com/mattpolzin/OpenAPIReflection.git", from: "3.0.0"), .package(url: "https://github.com/typelift/SwiftCheck.git", .upToNextMinor(from: "0.12.0")), .package(url: "https://github.com/apple/swift-format.git", from: "509.0.0"), .package(url: "https://github.com/pointfreeco/swift-nonempty.git", .upToNextMinor(from: "0.2.0")), - .package(url: "https://github.com/mattpolzin/JSONAPIViz.git", exact: "0.0.6") + .package(url: "https://github.com/mattpolzin/JSONAPIViz.git", exact: "0.0.7") ], targets: [ .target( @@ -82,5 +82,5 @@ let package = Package( ] ) ], - swiftLanguageVersions: [.v5] + swiftLanguageModes: [.v5,.v6] ) From 0824d75636ec58499e077fbde55a656ff4d2cf6e Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sun, 14 Sep 2025 20:51:47 -0500 Subject: [PATCH 3/6] don't bother with Swift 6 mode yet --- Package.resolved | 2 +- Package.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.resolved b/Package.resolved index fc0a0ac..7b56a09 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "18b6b3a9c61dea1e158c31a5b1ffef8354cca7a9c2dd0e1ea44111fd49e6aac9", + "originHash" : "58e508d9c3e87af1e13661a8049ff5332d67bffd9ade824f0e04300f6697f615", "pins" : [ { "identity" : "chalk", diff --git a/Package.swift b/Package.swift index d559349..8bc7b71 100644 --- a/Package.swift +++ b/Package.swift @@ -82,5 +82,5 @@ let package = Package( ] ) ], - swiftLanguageModes: [.v5,.v6] + swiftLanguageModes: [.v5] ) From 523d8e70885b620f2a3837ff9886de42605c6477 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Mon, 15 Sep 2025 09:07:18 -0500 Subject: [PATCH 4/6] drop CI and README support for pre-Swift 6 --- .github/workflows/tests.yml | 4 ---- README.md | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c5797d3..559ef72 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,10 +13,6 @@ jobs: fail-fast: false matrix: image: - - swift:5.9-focal - - swift:5.9-jammy - - swift:5.10-focal - - swift:5.10-jammy - swift:6.0-focal - swift:6.0-jammy - swift:6.1-focal diff --git a/README.md b/README.md index bd8adcc..d570c0b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # JSONAPI+OpenAPI -[![MIT license](http://img.shields.io/badge/license-MIT-lightgrey.svg)](http://opensource.org/licenses/MIT) [![Swift 5.9](http://img.shields.io/badge/Swift-5.9-blue.svg)](https://swift.org) [![Build Status](https://app.bitrise.io/app/2ae0b5578e1905b8/status.svg?token=T8UAUN08e1_GnYk1z3P98g&branch=main)](https://app.bitrise.io/app/2ae0b5578e1905b8) +[![MIT license](http://img.shields.io/badge/license-MIT-lightgrey.svg)](http://opensource.org/licenses/MIT) [![Swift 6.0+](http://img.shields.io/badge/Swift-6.x-blue.svg)](https://swift.org) [![Build Status](https://app.bitrise.io/app/2ae0b5578e1905b8/status.svg?token=T8UAUN08e1_GnYk1z3P98g&branch=main)](https://app.bitrise.io/app/2ae0b5578e1905b8) See parent project: https://github.com/mattpolzin/JSONAPI From c63593876053e4a3fda28d7b0a9659119d6fb002 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Mon, 15 Sep 2025 09:38:59 -0500 Subject: [PATCH 5/6] drop tests that relied upon old Linux stdlib behavior --- Tests/JSONAPIOpenAPITests/JSONAPIAttributeOpenAPITests.swift | 2 ++ .../JSONAPITransformedAttributeOpenAPITests.swift | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/JSONAPIOpenAPITests/JSONAPIAttributeOpenAPITests.swift b/Tests/JSONAPIOpenAPITests/JSONAPIAttributeOpenAPITests.swift index 6296d14..ffe20ae 100644 --- a/Tests/JSONAPIOpenAPITests/JSONAPIAttributeOpenAPITests.swift +++ b/Tests/JSONAPIOpenAPITests/JSONAPIAttributeOpenAPITests.swift @@ -651,6 +651,7 @@ extension JSONAPIAttributeOpenAPITests { // MARK: - Date extension JSONAPIAttributeOpenAPITests { +#if os(macOS) || os(iOS) func test_DateStringAttribute() { // TEST: // Encoder is set to use @@ -805,6 +806,7 @@ extension JSONAPIAttributeOpenAPITests { XCTAssertEqual(stringContext, .init()) } +#endif func test_8601DateStringAttribute() { if #available(OSX 10.12, *) { diff --git a/Tests/JSONAPIOpenAPITests/JSONAPITransformedAttributeOpenAPITests.swift b/Tests/JSONAPIOpenAPITests/JSONAPITransformedAttributeOpenAPITests.swift index 51ead8a..189ce92 100644 --- a/Tests/JSONAPIOpenAPITests/JSONAPITransformedAttributeOpenAPITests.swift +++ b/Tests/JSONAPIOpenAPITests/JSONAPITransformedAttributeOpenAPITests.swift @@ -657,6 +657,7 @@ extension JSONAPITransformedAttributeOpenAPITests { // MARK: - Date extension JSONAPITransformedAttributeOpenAPITests { +#if os(macOS) || os(iOS) func test_DateStringAttribute() { // TEST: // Encoder is set to use @@ -711,7 +712,6 @@ extension JSONAPITransformedAttributeOpenAPITests { let encoder = JSONEncoder() encoder.outputFormatting = .prettyPrinted encoder.dateEncodingStrategy = .formatted(dateFormatter) - let node = IdentityAttribute.dateOpenAPISchemaGuess(using: encoder)! XCTAssertTrue(node.required) @@ -812,6 +812,7 @@ extension JSONAPITransformedAttributeOpenAPITests { XCTAssertEqual(stringContext, .init()) } +#endif func test_8601DateStringAttribute() { if #available(OSX 10.12, *) { From 3aa205a71fd6f0e541a5441b71b19a9b4086e291 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Mon, 15 Sep 2025 09:51:51 -0500 Subject: [PATCH 6/6] another test that needs an exception for latest linux stdlib versions --- .../JSONAPIEntityOpenAPITests.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tests/JSONAPIOpenAPITests/JSONAPIEntityOpenAPITests.swift b/Tests/JSONAPIOpenAPITests/JSONAPIEntityOpenAPITests.swift index 5a3e3e6..c2a81bc 100644 --- a/Tests/JSONAPIOpenAPITests/JSONAPIEntityOpenAPITests.swift +++ b/Tests/JSONAPIOpenAPITests/JSONAPIEntityOpenAPITests.swift @@ -198,6 +198,7 @@ class JSONAPIEntityOpenAPITests: XCTestCase { ) ) +#if os(macOS) || os(iOS) XCTAssertEqual( attributesContext.properties["dateProperty"], .string( @@ -209,6 +210,19 @@ class JSONAPIEntityOpenAPITests: XCTestCase { .init() ) ) +#else + XCTAssertEqual( + attributesContext.properties["dateProperty"], + .string( + .init( + format: .generic, + required: true, + allowedValues: nil + ), + .init() + ) + ) +#endif XCTAssertEqual( attributesContext.properties["optionalProperty"],