Skip to content

Commit

Permalink
Bump OpenAPIKit to beta.5 (#266)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
czechboy0 authored Sep 13, 2023
1 parent 7364ff4 commit d7da4db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ let package = Package(
// Read OpenAPI documents
.package(
url: "https://github.com/mattpolzin/OpenAPIKit.git",
exact: "3.0.0-beta.3"
exact: "3.0.0-beta.5"
),
.package(
url: "https://github.com/jpsim/Yams.git",
Expand Down
7 changes: 6 additions & 1 deletion Sources/_OpenAPIGeneratorCore/Parser/validateDoc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
//
//===----------------------------------------------------------------------===//

import OpenAPIKit

/// Runs validation steps on the incoming OpenAPI document.
/// - Parameters:
/// - doc: The OpenAPI document to validate.
Expand All @@ -27,7 +29,10 @@ func validateDoc(_ doc: ParsedOpenAPIRepresentation, config: Config) throws -> [
// block the generator from running.
// Validation errors continue to be fatal, such as
// structural issues, like non-unique operationIds, etc.
let warnings = try doc.validate(strict: false)
let warnings = try doc.validate(
using: Validator().validating(.operationsContainResponses),
strict: false
)
let diagnostics: [Diagnostic] = warnings.map { warning in
.warning(
message: "Validation warning: \(warning.description)",
Expand Down
5 changes: 3 additions & 2 deletions Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ final class Test_YamsParser: Test_Core {
/foo.yaml: error: Found neither a $ref nor a PathItem in Document.paths['/system'].
PathItem could not be decoded because:
Expected to find `responses` key for the **GET** endpoint under `/system` but it is missing..
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 ]..
"""
assertThrownError(try _test(yaml), expectedDiagnostic: expected)
}
Expand All @@ -148,7 +148,8 @@ final class Test_YamsParser: Test_Core {
) {
XCTAssertThrowsError(try closure(), file: file, line: line) { error in
if let exitError = error as? Diagnostic {
XCTAssertEqual(exitError.localizedDescription, expectedDiagnostic, file: file, line: line)
let actualDiagnostic = exitError.localizedDescription
XCTAssertEqual(actualDiagnostic, expectedDiagnostic, file: file, line: line)
} else {
XCTFail("Thrown error is \(type(of: error)) but should be Diagnostic", file: file, line: line)
}
Expand Down

0 comments on commit d7da4db

Please sign in to comment.