Skip to content

Commit

Permalink
Add support for new patch versions of OAS
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin committed Nov 1, 2024
1 parent cf31c5d commit b5d474d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions Sources/OpenAPIKit/Document/Document.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down
1 change: 1 addition & 0 deletions Sources/OpenAPIKit30/Document/Document.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down
11 changes: 4 additions & 7 deletions Sources/OpenAPIKitCompat/Compat30To31.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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) },
Expand Down

0 comments on commit b5d474d

Please sign in to comment.