Skip to content

Commit 05efd97

Browse files
committed
Re-generate OFREP client using idiomatic naming strategy
1 parent bac44ad commit 05efd97

File tree

4 files changed

+301
-305
lines changed

4 files changed

+301
-305
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ $(GEN_SWIFTS): $(OPENAPI_SPEC) $(OPENAPI_GEN_SWIFT)
1414
$(OPENAPI_SPEC) \
1515
--mode types \
1616
--mode client \
17+
--naming-strategy idiomatic \
1718
--output-directory $(GEN_SWIFT_ROOT)
1819

1920
.PHONY: generate

Package.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@ import PackageDescription
33

44
let package = Package(
55
name: "swift-ofrep",
6-
platforms: [
7-
.macOS(.v10_15),
8-
.iOS(.v13),
9-
.watchOS(.v6),
10-
.tvOS(.v13),
11-
],
6+
platforms: [.macOS(.v15)],
127
products: [
138
.library(name: "OFREP", targets: ["OFREP"])
149
],
1510
dependencies: [
1611
.package(url: "https://github.com/swift-open-feature/swift-open-feature.git", branch: "main"),
17-
.package(url: "https://github.com/apple/swift-openapi-generator.git", from: "1.0.0"),
12+
.package(url: "https://github.com/apple/swift-openapi-generator.git", from: "1.7.0"),
1813
.package(url: "https://github.com/apple/swift-openapi-runtime.git", from: "1.0.0"),
1914
],
2015
targets: [

Sources/OFREP/Generated/Client.swift

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ internal struct Client: APIProtocol {
4646
///
4747
/// - Remark: HTTP `POST /ofrep/v1/evaluate/flags/{key}`.
4848
/// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post`.
49-
internal func post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_(_ input: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input) async throws -> Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output {
49+
internal func postOfrepV1EvaluateFlagsKey(_ input: Operations.PostOfrepV1EvaluateFlagsKey.Input) async throws -> Operations.PostOfrepV1EvaluateFlagsKey.Output {
5050
try await client.send(
5151
input: input,
52-
forOperation: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.id,
52+
forOperation: Operations.PostOfrepV1EvaluateFlagsKey.id,
5353
serializer: { input in
5454
let path = try converter.renderedPath(
5555
template: "/ofrep/v1/evaluate/flags/{}",
@@ -83,7 +83,7 @@ internal struct Client: APIProtocol {
8383
switch response.status.code {
8484
case 200:
8585
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
86-
let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Ok.Body
86+
let body: Operations.PostOfrepV1EvaluateFlagsKey.Output.Ok.Body
8787
let chosenContentType = try converter.bestContentType(
8888
received: contentType,
8989
options: [
@@ -93,7 +93,7 @@ internal struct Client: APIProtocol {
9393
switch chosenContentType {
9494
case "application/json":
9595
body = try await converter.getResponseBodyAsJSON(
96-
Components.Schemas.evaluationSuccess.self,
96+
Components.Schemas.EvaluationSuccess.self,
9797
from: responseBody,
9898
transforming: { value in
9999
.json(value)
@@ -105,7 +105,7 @@ internal struct Client: APIProtocol {
105105
return .ok(.init(body: body))
106106
case 400:
107107
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
108-
let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.BadRequest.Body
108+
let body: Operations.PostOfrepV1EvaluateFlagsKey.Output.BadRequest.Body
109109
let chosenContentType = try converter.bestContentType(
110110
received: contentType,
111111
options: [
@@ -115,7 +115,7 @@ internal struct Client: APIProtocol {
115115
switch chosenContentType {
116116
case "application/json":
117117
body = try await converter.getResponseBodyAsJSON(
118-
Components.Schemas.evaluationFailure.self,
118+
Components.Schemas.EvaluationFailure.self,
119119
from: responseBody,
120120
transforming: { value in
121121
.json(value)
@@ -127,7 +127,7 @@ internal struct Client: APIProtocol {
127127
return .badRequest(.init(body: body))
128128
case 404:
129129
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
130-
let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.NotFound.Body
130+
let body: Operations.PostOfrepV1EvaluateFlagsKey.Output.NotFound.Body
131131
let chosenContentType = try converter.bestContentType(
132132
received: contentType,
133133
options: [
@@ -137,7 +137,7 @@ internal struct Client: APIProtocol {
137137
switch chosenContentType {
138138
case "application/json":
139139
body = try await converter.getResponseBodyAsJSON(
140-
Components.Schemas.flagNotFound.self,
140+
Components.Schemas.FlagNotFound.self,
141141
from: responseBody,
142142
transforming: { value in
143143
.json(value)
@@ -152,15 +152,15 @@ internal struct Client: APIProtocol {
152152
case 403:
153153
return .forbidden(.init())
154154
case 429:
155-
let headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.TooManyRequests.Headers = .init(Retry_hyphen_After: try converter.getOptionalHeaderFieldAsURI(
155+
let headers: Operations.PostOfrepV1EvaluateFlagsKey.Output.TooManyRequests.Headers = .init(retryAfter: try converter.getOptionalHeaderFieldAsURI(
156156
in: response.headerFields,
157157
name: "Retry-After",
158158
as: Foundation.Date.self
159159
))
160160
return .tooManyRequests(.init(headers: headers))
161161
case 500:
162162
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
163-
let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.InternalServerError.Body
163+
let body: Operations.PostOfrepV1EvaluateFlagsKey.Output.InternalServerError.Body
164164
let chosenContentType = try converter.bestContentType(
165165
received: contentType,
166166
options: [
@@ -170,7 +170,7 @@ internal struct Client: APIProtocol {
170170
switch chosenContentType {
171171
case "application/json":
172172
body = try await converter.getResponseBodyAsJSON(
173-
Components.Schemas.generalErrorResponse.self,
173+
Components.Schemas.GeneralErrorResponse.self,
174174
from: responseBody,
175175
transforming: { value in
176176
.json(value)
@@ -200,10 +200,10 @@ internal struct Client: APIProtocol {
200200
///
201201
/// - Remark: HTTP `POST /ofrep/v1/evaluate/flags`.
202202
/// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post`.
203-
internal func post_sol_ofrep_sol_v1_sol_evaluate_sol_flags(_ input: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input) async throws -> Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output {
203+
internal func postOfrepV1EvaluateFlags(_ input: Operations.PostOfrepV1EvaluateFlags.Input) async throws -> Operations.PostOfrepV1EvaluateFlags.Output {
204204
try await client.send(
205205
input: input,
206-
forOperation: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.id,
206+
forOperation: Operations.PostOfrepV1EvaluateFlags.id,
207207
serializer: { input in
208208
let path = try converter.renderedPath(
209209
template: "/ofrep/v1/evaluate/flags",
@@ -217,7 +217,7 @@ internal struct Client: APIProtocol {
217217
try converter.setHeaderFieldAsURI(
218218
in: &request.headerFields,
219219
name: "If-None-Match",
220-
value: input.headers.If_hyphen_None_hyphen_Match
220+
value: input.headers.ifNoneMatch
221221
)
222222
converter.setAcceptHeader(
223223
in: &request.headerFields,
@@ -239,13 +239,13 @@ internal struct Client: APIProtocol {
239239
deserializer: { response, responseBody in
240240
switch response.status.code {
241241
case 200:
242-
let headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok.Headers = .init(ETag: try converter.getOptionalHeaderFieldAsURI(
242+
let headers: Operations.PostOfrepV1EvaluateFlags.Output.Ok.Headers = .init(eTag: try converter.getOptionalHeaderFieldAsURI(
243243
in: response.headerFields,
244244
name: "ETag",
245245
as: Swift.String.self
246246
))
247247
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
248-
let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok.Body
248+
let body: Operations.PostOfrepV1EvaluateFlags.Output.Ok.Body
249249
let chosenContentType = try converter.bestContentType(
250250
received: contentType,
251251
options: [
@@ -255,7 +255,7 @@ internal struct Client: APIProtocol {
255255
switch chosenContentType {
256256
case "application/json":
257257
body = try await converter.getResponseBodyAsJSON(
258-
Components.Schemas.bulkEvaluationSuccess.self,
258+
Components.Schemas.BulkEvaluationSuccess.self,
259259
from: responseBody,
260260
transforming: { value in
261261
.json(value)
@@ -272,7 +272,7 @@ internal struct Client: APIProtocol {
272272
return .notModified(.init())
273273
case 400:
274274
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
275-
let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.BadRequest.Body
275+
let body: Operations.PostOfrepV1EvaluateFlags.Output.BadRequest.Body
276276
let chosenContentType = try converter.bestContentType(
277277
received: contentType,
278278
options: [
@@ -282,7 +282,7 @@ internal struct Client: APIProtocol {
282282
switch chosenContentType {
283283
case "application/json":
284284
body = try await converter.getResponseBodyAsJSON(
285-
Components.Schemas.bulkEvaluationFailure.self,
285+
Components.Schemas.BulkEvaluationFailure.self,
286286
from: responseBody,
287287
transforming: { value in
288288
.json(value)
@@ -297,15 +297,15 @@ internal struct Client: APIProtocol {
297297
case 403:
298298
return .forbidden(.init())
299299
case 429:
300-
let headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.TooManyRequests.Headers = .init(Retry_hyphen_After: try converter.getOptionalHeaderFieldAsURI(
300+
let headers: Operations.PostOfrepV1EvaluateFlags.Output.TooManyRequests.Headers = .init(retryAfter: try converter.getOptionalHeaderFieldAsURI(
301301
in: response.headerFields,
302302
name: "Retry-After",
303303
as: Foundation.Date.self
304304
))
305305
return .tooManyRequests(.init(headers: headers))
306306
case 500:
307307
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
308-
let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.InternalServerError.Body
308+
let body: Operations.PostOfrepV1EvaluateFlags.Output.InternalServerError.Body
309309
let chosenContentType = try converter.bestContentType(
310310
received: contentType,
311311
options: [
@@ -315,7 +315,7 @@ internal struct Client: APIProtocol {
315315
switch chosenContentType {
316316
case "application/json":
317317
body = try await converter.getResponseBodyAsJSON(
318-
Components.Schemas.generalErrorResponse.self,
318+
Components.Schemas.GeneralErrorResponse.self,
319319
from: responseBody,
320320
transforming: { value in
321321
.json(value)
@@ -345,10 +345,10 @@ internal struct Client: APIProtocol {
345345
///
346346
/// - Remark: HTTP `GET /ofrep/v1/configuration`.
347347
/// - Remark: Generated from `#/paths//ofrep/v1/configuration/get`.
348-
internal func get_sol_ofrep_sol_v1_sol_configuration(_ input: Operations.get_sol_ofrep_sol_v1_sol_configuration.Input) async throws -> Operations.get_sol_ofrep_sol_v1_sol_configuration.Output {
348+
internal func getOfrepV1Configuration(_ input: Operations.GetOfrepV1Configuration.Input) async throws -> Operations.GetOfrepV1Configuration.Output {
349349
try await client.send(
350350
input: input,
351-
forOperation: Operations.get_sol_ofrep_sol_v1_sol_configuration.id,
351+
forOperation: Operations.GetOfrepV1Configuration.id,
352352
serializer: { input in
353353
let path = try converter.renderedPath(
354354
template: "/ofrep/v1/configuration",
@@ -362,7 +362,7 @@ internal struct Client: APIProtocol {
362362
try converter.setHeaderFieldAsURI(
363363
in: &request.headerFields,
364364
name: "If-None-Match",
365-
value: input.headers.If_hyphen_None_hyphen_Match
365+
value: input.headers.ifNoneMatch
366366
)
367367
converter.setAcceptHeader(
368368
in: &request.headerFields,
@@ -373,13 +373,13 @@ internal struct Client: APIProtocol {
373373
deserializer: { response, responseBody in
374374
switch response.status.code {
375375
case 200:
376-
let headers: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok.Headers = .init(ETag: try converter.getOptionalHeaderFieldAsURI(
376+
let headers: Operations.GetOfrepV1Configuration.Output.Ok.Headers = .init(eTag: try converter.getOptionalHeaderFieldAsURI(
377377
in: response.headerFields,
378378
name: "ETag",
379379
as: Swift.String.self
380380
))
381381
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
382-
let body: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok.Body
382+
let body: Operations.GetOfrepV1Configuration.Output.Ok.Body
383383
let chosenContentType = try converter.bestContentType(
384384
received: contentType,
385385
options: [
@@ -389,7 +389,7 @@ internal struct Client: APIProtocol {
389389
switch chosenContentType {
390390
case "application/json":
391391
body = try await converter.getResponseBodyAsJSON(
392-
Components.Schemas.configurationResponse.self,
392+
Components.Schemas.ConfigurationResponse.self,
393393
from: responseBody,
394394
transforming: { value in
395395
.json(value)
@@ -410,7 +410,7 @@ internal struct Client: APIProtocol {
410410
return .forbidden(.init())
411411
case 500:
412412
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
413-
let body: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.InternalServerError.Body
413+
let body: Operations.GetOfrepV1Configuration.Output.InternalServerError.Body
414414
let chosenContentType = try converter.bestContentType(
415415
received: contentType,
416416
options: [
@@ -420,7 +420,7 @@ internal struct Client: APIProtocol {
420420
switch chosenContentType {
421421
case "application/json":
422422
body = try await converter.getResponseBodyAsJSON(
423-
Components.Schemas.generalErrorResponse.self,
423+
Components.Schemas.GeneralErrorResponse.self,
424424
from: responseBody,
425425
transforming: { value in
426426
.json(value)

0 commit comments

Comments
 (0)