Skip to content

Commit d7da4db

Browse files
authored
Bump OpenAPIKit to beta.5 (#266)
### Motivation OpenAPIKit is getting ready to tag a 3.0.0 release candidate, so we need to keep on the latest version and ensure it works for us. ### Modifications Bumped from beta.3 to beta.5, contains some new features like `const` support. Adapted to the slight changes in behavior. ### Result Now using the latest version. ### Test Plan All tests pass again.
1 parent 7364ff4 commit d7da4db

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ let package = Package(
6464
// Read OpenAPI documents
6565
.package(
6666
url: "https://github.com/mattpolzin/OpenAPIKit.git",
67-
exact: "3.0.0-beta.3"
67+
exact: "3.0.0-beta.5"
6868
),
6969
.package(
7070
url: "https://github.com/jpsim/Yams.git",

Sources/_OpenAPIGeneratorCore/Parser/validateDoc.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import OpenAPIKit
16+
1517
/// Runs validation steps on the incoming OpenAPI document.
1618
/// - Parameters:
1719
/// - doc: The OpenAPI document to validate.
@@ -27,7 +29,10 @@ func validateDoc(_ doc: ParsedOpenAPIRepresentation, config: Config) throws -> [
2729
// block the generator from running.
2830
// Validation errors continue to be fatal, such as
2931
// structural issues, like non-unique operationIds, etc.
30-
let warnings = try doc.validate(strict: false)
32+
let warnings = try doc.validate(
33+
using: Validator().validating(.operationsContainResponses),
34+
strict: false
35+
)
3136
let diagnostics: [Diagnostic] = warnings.map { warning in
3237
.warning(
3338
message: "Validation warning: \(warning.description)",

Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ final class Test_YamsParser: Test_Core {
123123
/foo.yaml: error: Found neither a $ref nor a PathItem in Document.paths['/system'].
124124
125125
PathItem could not be decoded because:
126-
Expected to find `responses` key for the **GET** endpoint under `/system` but it is missing..
126+
Inconsistency encountered when parsing `Vendor Extension` for the **GET** endpoint under `/system`: Found at least one vendor extension property that does not begin with the required 'x-' prefix. Invalid properties: [ resonance ]..
127127
"""
128128
assertThrownError(try _test(yaml), expectedDiagnostic: expected)
129129
}
@@ -148,7 +148,8 @@ final class Test_YamsParser: Test_Core {
148148
) {
149149
XCTAssertThrowsError(try closure(), file: file, line: line) { error in
150150
if let exitError = error as? Diagnostic {
151-
XCTAssertEqual(exitError.localizedDescription, expectedDiagnostic, file: file, line: line)
151+
let actualDiagnostic = exitError.localizedDescription
152+
XCTAssertEqual(actualDiagnostic, expectedDiagnostic, file: file, line: line)
152153
} else {
153154
XCTFail("Thrown error is \(type(of: error)) but should be Diagnostic", file: file, line: line)
154155
}

0 commit comments

Comments
 (0)