Skip to content

Commit bbbdd6d

Browse files
authored
Merge branch 'apple:main' into feature/deep_object_style
2 parents 82556e6 + 8226ced commit bbbdd6d

File tree

7 files changed

+23
-15
lines changed

7 files changed

+23
-15
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The Swift OpenAPI Generator project is split across multiple repositories to ena
8787
| [swift-server/swift-openapi-async-http-client][repo-ahc] | `ClientTransport` using [AsyncHTTPClient][ahc] |
8888
| [swift-server/swift-openapi-vapor][repo-vapor] | `ServerTransport` using [Vapor][vapor] |
8989
| [swift-server/swift-openapi-hummingbird][repo-hummingbird] | `ServerTransport` using [Hummingbird][hummingbird] |
90-
90+
| [swift-server/swift-openapi-lambda][repo-lambda] | `ServerTransport` using [AWS Lambda][lambda] |
9191

9292
## Requirements and supported features
9393

@@ -135,6 +135,8 @@ Generator](https://developer.apple.com/wwdc23/10171) from WWDC23.
135135
[vapor]: https://github.com/vapor/vapor
136136
[repo-hummingbird]: https://github.com/swift-server/swift-openapi-hummingbird
137137
[hummingbird]: https://github.com/hummingbird-project/hummingbird
138+
[repo-lambda]: https://github.com/swift-server/swift-openapi-lambda
139+
[lambda]: https://docs.aws.amazon.com/lambda/latest/dg/welcome.html
138140
[^example-openapi-yaml]: <details><summary>Example OpenAPI document (click to expand)</summary>
139141

140142
```yaml

Sources/_OpenAPIGeneratorCore/Translator/CommonTypes/Constants.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ enum Constants {
146146
static let baseConformanceInteger: String = "Int"
147147

148148
/// The types that every enum conforms to.
149-
static let conformances: [String] = ["Codable", "Hashable", "Sendable"]
149+
static let conformances: [String] = ["Codable", "Hashable", "Sendable", "CaseIterable"]
150150
}
151151

152152
/// Constants related to generated oneOf enums.

Sources/swift-openapi-generator/Documentation.docc/Swift-OpenAPI-Generator.md

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ The Swift OpenAPI Generator project is split across multiple repositories to ena
8686
| [swift-server/swift-openapi-async-http-client][repo-ahc] | `ClientTransport` using [AsyncHTTPClient][ahc] |
8787
| [swift-server/swift-openapi-vapor][repo-vapor] | `ServerTransport` using [Vapor][vapor] |
8888
| [swift-server/swift-openapi-hummingbird][repo-hummingbird] | `ServerTransport` using [Hummingbird][hummingbird] |
89+
| [swift-server/swift-openapi-lambda][repo-lambda] | `ServerTransport` using [AWS Lambda][lambda] |
8990

9091
### Requirements and supported features
9192

@@ -198,3 +199,5 @@ components:
198199
[vapor]: https://github.com/vapor/vapor
199200
[repo-hummingbird]: https://github.com/swift-server/swift-openapi-hummingbird
200201
[hummingbird]: https://github.com/hummingbird-project/hummingbird
202+
[repo-lambda]: https://github.com/swift-server/swift-openapi-lambda
203+
[lambda]: https://docs.aws.amazon.com/lambda/latest/dg/welcome.html

Tests/OpenAPIGeneratorReferenceTests/CompatabilityTest.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ final class CompatibilityTest: XCTestCase {
8585

8686
func testDiscourse() async throws {
8787
try await _test(
88-
"https://raw.githubusercontent.com/discourse/discourse_api_docs/fa2391353e9c3eb016ccae30daa34467d2ac2616/openapi.yml",
88+
"https://raw.githubusercontent.com/discourse/discourse_api_docs/8182f1b21ca62cc9ac85fd3a82cae8304033a672/openapi.yml",
8989
license: .apache,
9090
expectedDiagnostics: [
9191
"Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found nothing but unsupported attributes..",
@@ -109,6 +109,7 @@ final class CompatibilityTest: XCTestCase {
109109
"A property name only appears in the required list, but not in the properties map - this is likely a typo; skipping this property.",
110110
"Schema warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: array. Specifically, attributes for these other types: [\"object\"].",
111111
"Schema warning: Inconsistency encountered when parsing `Schema`: A schema contains properties for multiple types of schemas, namely: [\"array\", \"object\"]..",
112+
"Schema \"null\" is not supported, reason: \"schema type\", skipping",
112113
],
113114
skipBuild: true
114115
)
@@ -125,6 +126,7 @@ final class CompatibilityTest: XCTestCase {
125126
"A property name only appears in the required list, but not in the properties map - this is likely a typo; skipping this property.",
126127
"Validation warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"object\"].",
127128
"Schema warning: Inconsistency encountered when parsing `OpenAPI Schema`: Found schema attributes not consistent with the type specified: string. Specifically, attributes for these other types: [\"array\"].",
129+
"Schema \"null\" is not supported, reason: \"schema type\", skipping",
128130
],
129131
skipBuild: true
130132
)

Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/Petstore/Types.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public enum Components {
405405
/// Kind of pet
406406
///
407407
/// - Remark: Generated from `#/components/schemas/PetKind`.
408-
@frozen public enum PetKind: String, Codable, Hashable, Sendable {
408+
@frozen public enum PetKind: String, Codable, Hashable, Sendable, CaseIterable {
409409
case cat = "cat"
410410
case dog = "dog"
411411
case ELEPHANT = "ELEPHANT"
@@ -492,7 +492,7 @@ public enum Components {
492492
/// - Remark: Generated from `#/components/schemas/PetFeeding`.
493493
public struct PetFeeding: Codable, Hashable, Sendable {
494494
/// - Remark: Generated from `#/components/schemas/PetFeeding/schedule`.
495-
@frozen public enum schedulePayload: String, Codable, Hashable, Sendable {
495+
@frozen public enum schedulePayload: String, Codable, Hashable, Sendable, CaseIterable {
496496
case hourly = "hourly"
497497
case daily = "daily"
498498
case weekly = "weekly"
@@ -1491,7 +1491,7 @@ public enum Components {
14911491
/// - Remark: Generated from `#/components/requestBodies/MultipartUploadTypedRequest/multipartForm/log/headers`.
14921492
public struct Headers: Sendable, Hashable {
14931493
/// - Remark: Generated from `#/components/requestBodies/MultipartUploadTypedRequest/multipartForm/log/headers/x-log-type`.
1494-
@frozen public enum x_hyphen_log_hyphen_typePayload: String, Codable, Hashable, Sendable {
1494+
@frozen public enum x_hyphen_log_hyphen_typePayload: String, Codable, Hashable, Sendable, CaseIterable {
14951495
case structured = "structured"
14961496
case unstructured = "unstructured"
14971497
}
@@ -1645,7 +1645,7 @@ public enum Components {
16451645
/// - Remark: Generated from `#/components/responses/MultipartDownloadTypedResponse/content/multipartForm/log/headers`.
16461646
public struct Headers: Sendable, Hashable {
16471647
/// - Remark: Generated from `#/components/responses/MultipartDownloadTypedResponse/content/multipartForm/log/headers/x-log-type`.
1648-
@frozen public enum x_hyphen_log_hyphen_typePayload: String, Codable, Hashable, Sendable {
1648+
@frozen public enum x_hyphen_log_hyphen_typePayload: String, Codable, Hashable, Sendable, CaseIterable {
16491649
case structured = "structured"
16501650
case unstructured = "unstructured"
16511651
}
@@ -1773,7 +1773,7 @@ public enum Operations {
17731773
/// - Remark: Generated from `#/paths/pets/GET/query/limit`.
17741774
public var limit: Swift.Int32?
17751775
/// - Remark: Generated from `#/paths/pets/GET/query/habitat`.
1776-
@frozen public enum habitatPayload: String, Codable, Hashable, Sendable {
1776+
@frozen public enum habitatPayload: String, Codable, Hashable, Sendable, CaseIterable {
17771777
case water = "water"
17781778
case land = "land"
17791779
case air = "air"
@@ -1782,7 +1782,7 @@ public enum Operations {
17821782
/// - Remark: Generated from `#/paths/pets/GET/query/habitat`.
17831783
public var habitat: Operations.listPets.Input.Query.habitatPayload?
17841784
/// - Remark: Generated from `#/paths/pets/GET/query/feedsPayload`.
1785-
@frozen public enum feedsPayloadPayload: String, Codable, Hashable, Sendable {
1785+
@frozen public enum feedsPayloadPayload: String, Codable, Hashable, Sendable, CaseIterable {
17861786
case omnivore = "omnivore"
17871787
case carnivore = "carnivore"
17881788
case herbivore = "herbivore"

Tests/OpenAPIGeneratorReferenceTests/SnippetBasedReferenceTests.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ final class SnippetBasedReferenceTests: XCTestCase {
11891189
""",
11901190
"""
11911191
public enum Schemas {
1192-
@frozen public enum MyEnum: String, Codable, Hashable, Sendable {
1192+
@frozen public enum MyEnum: String, Codable, Hashable, Sendable, CaseIterable {
11931193
case one = "one"
11941194
case _empty = ""
11951195
case _dollar_tart = "$tart"
@@ -1213,7 +1213,7 @@ final class SnippetBasedReferenceTests: XCTestCase {
12131213
""",
12141214
"""
12151215
public enum Schemas {
1216-
@frozen public enum MyEnum: Int, Codable, Hashable, Sendable {
1216+
@frozen public enum MyEnum: Int, Codable, Hashable, Sendable, CaseIterable {
12171217
case _0 = 0
12181218
case _10 = 10
12191219
case _20 = 20
@@ -1238,7 +1238,7 @@ final class SnippetBasedReferenceTests: XCTestCase {
12381238
"""
12391239
public enum Schemas {
12401240
public struct MyOpenEnum: Codable, Hashable, Sendable {
1241-
@frozen public enum Value1Payload: String, Codable, Hashable, Sendable {
1241+
@frozen public enum Value1Payload: String, Codable, Hashable, Sendable, CaseIterable {
12421242
case one = "one"
12431243
case two = "two"
12441244
}
@@ -1928,7 +1928,7 @@ final class SnippetBasedReferenceTests: XCTestCase {
19281928
public enum Responses {
19291929
public struct BadRequest: Sendable, Hashable {
19301930
public struct Headers: Sendable, Hashable {
1931-
@frozen public enum X_hyphen_ReasonPayload: String, Codable, Hashable, Sendable {
1931+
@frozen public enum X_hyphen_ReasonPayload: String, Codable, Hashable, Sendable, CaseIterable {
19321932
case badLuck = "badLuck"
19331933
}
19341934
public var X_hyphen_Reason: Components.Responses.BadRequest.Headers.X_hyphen_ReasonPayload?
@@ -2118,7 +2118,7 @@ final class SnippetBasedReferenceTests: XCTestCase {
21182118
@frozen public enum multipartFormPayload: Sendable, Hashable {
21192119
public struct logPayload: Sendable, Hashable {
21202120
public struct Headers: Sendable, Hashable {
2121-
@frozen public enum x_hyphen_log_hyphen_typePayload: String, Codable, Hashable, Sendable {
2121+
@frozen public enum x_hyphen_log_hyphen_typePayload: String, Codable, Hashable, Sendable, CaseIterable {
21222122
case structured = "structured"
21232123
case unstructured = "unstructured"
21242124
}

docker/docker-compose.2204.510.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ services:
55
image: &image swift-openapi-generator:22.04-5.10
66
build:
77
args:
8-
base_image: "swiftlang/swift:nightly-5.10-jammy"
8+
ubuntu_version: "jammy"
9+
swift_version: "5.10"
910

1011
test:
1112
image: *image

0 commit comments

Comments
 (0)