From b5d474da0be1329c692f1ef9ae1d63556fe7c476 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 1 Nov 2024 10:50:59 -0500 Subject: [PATCH] Add support for new patch versions of OAS --- Sources/OpenAPIKit/Document/Document.swift | 1 + Sources/OpenAPIKit30/Document/Document.swift | 1 + Sources/OpenAPIKitCompat/Compat30To31.swift | 11 ++++------- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Sources/OpenAPIKit/Document/Document.swift b/Sources/OpenAPIKit/Document/Document.swift index d9c293429..0e302d4c9 100644 --- a/Sources/OpenAPIKit/Document/Document.swift +++ b/Sources/OpenAPIKit/Document/Document.swift @@ -374,6 +374,7 @@ extension OpenAPI.Document { /// OpenAPIKit to a certain extent. public enum Version: String, Codable { case v3_1_0 = "3.1.0" + case v3_1_1 = "3.1.1" } } diff --git a/Sources/OpenAPIKit30/Document/Document.swift b/Sources/OpenAPIKit30/Document/Document.swift index 4f4baffd5..8f2b06158 100644 --- a/Sources/OpenAPIKit30/Document/Document.swift +++ b/Sources/OpenAPIKit30/Document/Document.swift @@ -361,6 +361,7 @@ extension OpenAPI.Document { case v3_0_1 = "3.0.1" case v3_0_2 = "3.0.2" case v3_0_3 = "3.0.3" + case v3_0_4 = "3.0.4" } } diff --git a/Sources/OpenAPIKitCompat/Compat30To31.swift b/Sources/OpenAPIKitCompat/Compat30To31.swift index 92629cf08..b963f6042 100644 --- a/Sources/OpenAPIKitCompat/Compat30To31.swift +++ b/Sources/OpenAPIKitCompat/Compat30To31.swift @@ -10,10 +10,7 @@ import OpenAPIKit30 public extension OpenAPIKit30.OpenAPI.Document { func `convert`(to version: OpenAPIKit.OpenAPI.Document.Version) -> OpenAPIKit.OpenAPI.Document { - switch version { - case .v3_1_0: - return self.to31() - } + return self.to31(version: version) } } @@ -22,10 +19,10 @@ private protocol To31 { func to31() -> Destination } -extension OpenAPIKit30.OpenAPI.Document: To31 { - fileprivate func to31() -> OpenAPIKit.OpenAPI.Document { +extension OpenAPIKit30.OpenAPI.Document { + fileprivate func to31(version: OpenAPIKit.OpenAPI.Document.Version = .v3_1_0) -> OpenAPIKit.OpenAPI.Document { OpenAPIKit.OpenAPI.Document( - openAPIVersion: .v3_1_0, + openAPIVersion: version, info: info.to31(), servers: servers.map { $0.to31() }, paths: paths.mapValues { eitherRefTo31($0) },