Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump OpenAPIKit to beta.5 #266

Merged
merged 1 commit into from
Sep 13, 2023
Merged
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 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),
czechboy0 marked this conversation as resolved.
Show resolved Hide resolved
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