Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [pull_request]
jobs:
codecov:
container:
image: swift:5.10
image: swift:6.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: swift:5.10
image: swift:6.2

steps:
- uses: actions/checkout@v5
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
fail-fast: false
matrix:
image:
- swift:5.10-focal
- swift:5.10-jammy
- swift:6.0-focal
- swift:6.0-jammy
- swift:6.0-noble
Expand Down
11 changes: 6 additions & 5 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.10
// swift-tools-version: 6.0

import PackageDescription

Expand All @@ -21,7 +21,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/jpsim/Yams.git", "5.1.0"..<"7.0.0") // just for tests
.package(url: "https://github.com/jpsim/Yams.git", "6.0.0"..<"7.0.0") // just for tests
],
targets: [
.target(
Expand Down Expand Up @@ -74,5 +74,5 @@ let package = Package(
name: "OpenAPIKitCompatTests",
dependencies: ["OpenAPIKitCompat"])
],
swiftLanguageVersions: [ .v5 ]
swiftLanguageModes: [ .v5, .v6 ]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![sswg:sandbox|94x20](https://img.shields.io/badge/sswg-sandbox-lightgrey.svg)](https://github.com/swift-server/sswg/blob/master/process/incubation.md#sandbox-level) [![Swift 5.10+](http://img.shields.io/badge/Swift-5.10+-blue.svg)](https://swift.org)
[![sswg:sandbox|94x20](https://img.shields.io/badge/sswg-sandbox-lightgrey.svg)](https://github.com/swift-server/sswg/blob/master/process/incubation.md#sandbox-level) [![Swift 6.0+](http://img.shields.io/badge/Swift-6.0+-blue.svg)](https://swift.org)

[![MIT license](http://img.shields.io/badge/license-MIT-lightgrey.svg)](http://opensource.org/licenses/MIT) ![Tests](https://github.com/mattpolzin/OpenAPIKit/actions/workflows/tests.yml/badge.svg?branch=main)

Expand All @@ -16,9 +16,9 @@ versions and key features are supported by which OpenAPIKit versions.

| OpenAPIKit | Swift | OpenAPI v3.0, v3.1 | External Dereferencing & Sendable | OpenAPI v3.2 |
|------------|-------|--------------------|-----------------------------------|--------------|
| v3.x | 5.1+ | ✅ | | |
| v4.x | 5.8+ | ✅ | ✅ | |
| v5.x | 5.10+ | ✅ | ✅ | ✅ |
| v6.x | 6.0+ | ✅ | ✅ | ✅ |

- [Usage](#usage)
- [Migration](#migration)
Expand Down
2 changes: 0 additions & 2 deletions Sources/OpenAPIKitCore/AnyCodable/AnyCodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,8 @@ extension AnyCodable: Encodable {
try container.encode(nsnumber.floatValue)
case .doubleType, .float64Type, .cgFloatType:
try container.encode(nsnumber.doubleValue)
#if swift(>=5.0)
@unknown default:
fatalError()
#endif
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion Tests/AnyCodableTests/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func testStringFromEncoding<T: Encodable>(of entity: T) throws -> String? {
return String(data: try testEncoder.encode(entity), encoding: .utf8)
}

func assertJSONEquivalent(_ str1: String?, _ str2: String?, file: StaticString = #file, line: UInt = #line) {
func assertJSONEquivalent(_ str1: String?, _ str2: String?, file: StaticString = #filePath, line: UInt = #line) {

// when testing on Linux, pretty printing has slightly different
// meaning so the tests pass on OS X as written but need whitespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class ComponentErrorTests: XCTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class DocumentErrorTests: XCTestCase {

Expand Down
2 changes: 1 addition & 1 deletion Tests/OpenAPIKit30ErrorReportingTests/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
//

import Foundation
@preconcurrency import Yams
import Yams

var testDecoder: YAMLDecoder { YAMLDecoder() }
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class JSONReferenceErrorTests: XCTestCase {
func test_referenceFailedToParse() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class OperationErrorTests: XCTestCase {
func test_missingResponses() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class PathsErrorTests: XCTestCase {
func test_missingPaths() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class RequestContentMapErrorTests: XCTestCase {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class RequestContentSchemaErrorTests: XCTestCase {
func test_wrongTypeContentSchemaTypeProperty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class RequestErrorTests: XCTestCase {
func test_wrongTypeRequest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class ResponseErrorTests: XCTestCase {
func test_headerWithContentAndSchema() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class SchemaErrorTests: XCTestCase {
func test_nonIntegerMaximumForIntegerSchema() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class SecuritySchemeErrorTests: XCTestCase {
func test_missingSecuritySchemeError() {
Expand Down
18 changes: 11 additions & 7 deletions Tests/OpenAPIKit30RealSpecSuite/GitHubAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
Expand All @@ -27,19 +27,23 @@ final class GitHubAPICampatibilityTests: XCTestCase {
commit for now.
*/
if githubAPI == nil {
// Test file can be redownloaded from
// https://raw.githubusercontent.com/github/rest-api-description/e4f28959fbc6c9fc4eea823b495061dded87e84d/descriptions/ghes-3.0/ghes-3.0.yaml
githubAPI = Result {
try YAMLDecoder().decode(
OpenAPI.Document.self,
from: String(contentsOf: URL(string: "https://raw.githubusercontent.com/github/rest-api-description/e4f28959fbc6c9fc4eea823b495061dded87e84d/descriptions/ghes-3.0/ghes-3.0.yaml")!)
let currentWorkingDirectory = FileManager.default.currentDirectoryPath
return try YAMLDecoder().decode(
OpenAPI.Document.self,
from: String(
contentsOf: URL(
filePath: "./Tests/inputs/ghes-3.0.yaml",
relativeTo: URL(filePath: currentWorkingDirectory, directoryHint: .isDirectory)),
encoding: .utf8)
)
}
}
}

func test_successfullyParsedDocument() throws {
#if os(Linux) && compiler(>=6.0)
throw XCTSkip("Swift bug causes CI failure currently (line 48): failed - The operation could not be completed. The file doesn’t exist.")
#endif
switch githubAPI {
case nil:
XCTFail("Did not attempt to pull GitHub API documentation like expected.")
Expand Down
18 changes: 11 additions & 7 deletions Tests/OpenAPIKit30RealSpecSuite/GoogleBooksAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
Expand All @@ -22,19 +22,23 @@ final class GoogleBooksAPICampatibilityTests: XCTestCase {

override func setUp() {
if booksAPI == nil {
// Test file can be redownloaded from
// https://raw.githubusercontent.com/APIs-guru/openapi-directory/master/APIs/googleapis.com/books/v1/openapi.yaml
booksAPI = Result {
try YAMLDecoder().decode(
OpenAPI.Document.self,
from: String(contentsOf: URL(string: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/master/APIs/googleapis.com/books/v1/openapi.yaml")!)
let currentWorkingDirectory = FileManager.default.currentDirectoryPath
return try YAMLDecoder().decode(
OpenAPI.Document.self,
from: String(
contentsOf: URL(
filePath: "./Tests/inputs/google-books-3.0.yaml",
relativeTo: URL(filePath: currentWorkingDirectory, directoryHint: .isDirectory)),
encoding: .utf8)
)
}
}
}

func test_successfullyParsedDocument() throws {
#if os(Linux) && compiler(>=6.0)
throw XCTSkip("Swift bug causes CI failure currently (line 48): failed - The operation could not be completed. The file doesn’t exist.")
#endif
switch booksAPI {
case nil:
XCTFail("Did not attempt to pull Google Books API documentation like expected.")
Expand Down
18 changes: 11 additions & 7 deletions Tests/OpenAPIKit30RealSpecSuite/PetStoreAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
Expand All @@ -22,19 +22,23 @@ final class PetStoreAPICampatibilityTests: XCTestCase {

override func setUp() {
if petStoreAPI == nil {
// Test file can be redownloaded from
// https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml
petStoreAPI = Result {
try YAMLDecoder().decode(
OpenAPI.Document.self,
from: String(contentsOf: URL(string: "https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml")!)
let currentWorkingDirectory = FileManager.default.currentDirectoryPath
return try YAMLDecoder().decode(
OpenAPI.Document.self,
from: String(
contentsOf: URL(
filePath: "./Tests/inputs/pet-store-3.0.yaml",
relativeTo: URL(filePath: currentWorkingDirectory, directoryHint: .isDirectory)),
encoding: .utf8)
)
}
}
}

func test_successfullyParsedDocument() throws {
#if os(Linux) && compiler(>=6.0)
throw XCTSkip("Swift bug causes CI failure currently (line 48): failed - The operation could not be completed. The file doesn’t exist.")
#endif
switch petStoreAPI {
case nil:
XCTFail("Did not attempt to pull Pet Store API documentation like expected.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams

final class SwaggerDocSamplesTests: XCTestCase {
func test_allOfExample() throws {
Expand Down
18 changes: 11 additions & 7 deletions Tests/OpenAPIKit30RealSpecSuite/TomTomAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import XCTest
import OpenAPIKit30
@preconcurrency import Yams
import Yams
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
Expand All @@ -22,19 +22,23 @@ final class TomTomAPICampatibilityTests: XCTestCase {

override func setUp() {
if tomtomAPI == nil {
// Test file can be redownloaded from
// https://raw.githubusercontent.com/APIs-guru/openapi-directory/c9190db19e5cb151592d44f0d4482839e1e5a8e0/APIs/tomtom.com/search/1.0.0/openapi.yaml
tomtomAPI = Result {
try YAMLDecoder().decode(
OpenAPI.Document.self,
from: String(contentsOf: URL(string: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/c9190db19e5cb151592d44f0d4482839e1e5a8e0/APIs/tomtom.com/search/1.0.0/openapi.yaml")!)
let currentWorkingDirectory = FileManager.default.currentDirectoryPath
return try YAMLDecoder().decode(
OpenAPI.Document.self,
from: String(
contentsOf: URL(
filePath: "./Tests/inputs/tomtom-3.0.yaml",
relativeTo: URL(filePath: currentWorkingDirectory, directoryHint: .isDirectory)),
encoding: .utf8)
)
}
}
}

func test_successfullyParsedDocument() throws {
#if os(Linux) && compiler(>=6.0)
throw XCTSkip("Swift bug causes CI failure currently (line 43): failed - The operation could not be completed. The file doesn’t exist.")
#endif
switch tomtomAPI {
case nil:
XCTFail("Did not attempt to pull TomTom API documentation like expected.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//

import Foundation
@preconcurrency import Yams
import Yams
import OpenAPIKit30
import XCTest

Expand Down
Loading