From 31fa50a3f213d855b9425e3de9aa91ffa89acd5d Mon Sep 17 00:00:00 2001 From: Deirdre Saoirse Moen Date: Thu, 21 Nov 2024 22:27:59 -0800 Subject: [PATCH] Make error message for missing "openapi" key clearer. (#678) --- Sources/_OpenAPIGeneratorCore/Parser/YamsParser.swift | 2 +- Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/_OpenAPIGeneratorCore/Parser/YamsParser.swift b/Sources/_OpenAPIGeneratorCore/Parser/YamsParser.swift index 467b001b..4e462091 100644 --- a/Sources/_OpenAPIGeneratorCore/Parser/YamsParser.swift +++ b/Sources/_OpenAPIGeneratorCore/Parser/YamsParser.swift @@ -139,7 +139,7 @@ extension Diagnostic { static func openAPIMissingVersionError(location: Location) -> Diagnostic { error( message: - "No openapi key found, please provide a valid OpenAPI document with OpenAPI versions in the 3.0.x or 3.1.x sets.", + "No key named openapi found. Please provide a valid OpenAPI document with OpenAPI versions in the 3.0.x or 3.1.x sets.", location: location ) } diff --git a/Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift b/Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift index 7b681bce..f7638d87 100644 --- a/Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift +++ b/Tests/OpenAPIGeneratorCoreTests/Parser/Test_YamsParser.swift @@ -56,7 +56,7 @@ final class Test_YamsParser: Test_Core { """ let expected = - "/foo.yaml: error: No openapi key found, please provide a valid OpenAPI document with OpenAPI versions in the 3.0.x or 3.1.x sets." + "/foo.yaml: error: No key named openapi found. Please provide a valid OpenAPI document with OpenAPI versions in the 3.0.x or 3.1.x sets." assertThrownError(try _test(yaml), expectedDiagnostic: expected) }