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

Add support for new patch versions of OAS #386

Merged
merged 1 commit into from
Nov 1, 2024
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
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