Skip to content

Commit 15f8f4f

Browse files
authored
Merge pull request #114 from ryansobol/idiomatic-naming-strategy
Switch to Idiomatic Swift Naming Convention
2 parents 0f61eb4 + 0f65313 commit 15f8f4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+90066
-85565
lines changed

Mintfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
2-
apple/swift-openapi-generator@1.2.1
2+
apple/swift-openapi-generator@1.7.2

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import GitHubRestAPIUsers
1414
import OpenAPIRuntime
1515
import OpenAPIURLSession
1616

17-
let client = Client(serverURL: try Servers.server1(), transport: URLSessionTransport())
18-
let users = try await client.users_sol_list().ok.body.json
17+
let client = Client(serverURL: try Servers.Server1.url(), transport: URLSessionTransport())
18+
let users = try await client.usersList().ok.body.json
1919
```
2020

2121
<details>
@@ -91,23 +91,23 @@ struct GitHubRestAPIIssuesExtension {
9191
let newBody = "\(body)\n\n\(hidingContent)"
9292

9393
let client = Client(
94-
serverURL: try Servers.server1(),
94+
serverURL: try Servers.Server1.url(),
9595
transport: URLSessionTransport(),
9696
middlewares: [AuthenticationMiddleware(token: nil)]
9797
)
9898

99-
let comments = try await client.issues_sol_list_hyphen_comments(
100-
path: .init(owner: owner, repo: repo, issue_number: number)
99+
let comments = try await client.issuesListComments(
100+
path: .init(owner: owner, repo: repo, issueNumber: number)
101101
).ok.body.json
102102

103103
if let comment = comments.first(where: { $0.body?.contains(hidingContent) == true }) {
104-
_ = try await client.issues_sol_update_hyphen_comment(
105-
path: .init(owner: owner, repo: repo, comment_id: Components.Parameters.comment_hyphen_id(comment.id)),
104+
_ = try await client.issuesUpdateComment(
105+
path: .init(owner: owner, repo: repo, commentId: comment.id),
106106
body: .json(.init(body: newBody))
107107
)
108108
} else {
109-
_ = try await client.issues_sol_create_hyphen_comment(
110-
path: .init(owner: owner, repo: repo, issue_number: number),
109+
_ = try await client.issuesCreateComment(
110+
path: .init(owner: owner, repo: repo, issueNumber: number),
111111
body: .json(.init(body: newBody))
112112
)
113113
}
@@ -130,7 +130,7 @@ import HTTPTypes
130130
let token: String = "***"
131131

132132
let client = Client(
133-
serverURL: try Servers.server1(),
133+
serverURL: try Servers.Server1.url(),
134134
transport: URLSessionTransport(),
135135
middlewares: [AuthenticationMiddleware(token: token)]
136136
)

Scripts/GeneratorConfigBuilder.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ struct GeneratorConfigBuilder {
3030
- \#(tagString)
3131

3232
accessModifier: public
33+
34+
namingStrategy: idiomatic
35+
36+
nameOverrides:
37+
'reactions-+1': reactionsThumbsUp
38+
'reactions--1': reactionsThumbsDown
3339
"""#
3440
}
3541

@@ -59,4 +65,3 @@ if let argTag = CommandLine.arguments[1]
5965
} else {
6066
throw ErrorMessage(message: "No tag not found.")
6167
}
62-

Sources/actions/Client.swift

+763-763
Large diffs are not rendered by default.

Sources/actions/Types.swift

+7,508-7,083
Large diffs are not rendered by default.

Sources/activity/Client.swift

+223-223
Large diffs are not rendered by default.

Sources/activity/Types.swift

+3,020-2,819
Large diffs are not rendered by default.

Sources/apps/Client.swift

+297-297
Large diffs are not rendered by default.

Sources/apps/Types.swift

+2,902-2,749
Large diffs are not rendered by default.

Sources/billing/Client.swift

+38-38
Large diffs are not rendered by default.

Sources/billing/Types.swift

+407-398
Large diffs are not rendered by default.

Sources/campaigns/Client.swift

+54-54
Large diffs are not rendered by default.

Sources/campaigns/Types.swift

+561-536
Large diffs are not rendered by default.

Sources/checks/Client.swift

+80-80
Large diffs are not rendered by default.

Sources/checks/Types.swift

+1,465-1,456
Large diffs are not rendered by default.

Sources/classroom/Client.swift

+38-38
Large diffs are not rendered by default.

Sources/classroom/Types.swift

+406-397
Large diffs are not rendered by default.

Sources/code-scanning/Client.swift

+270-248
Large diffs are not rendered by default.

Sources/code-scanning/Types.swift

+2,257-2,125
Large diffs are not rendered by default.

Sources/code-security/Client.swift

+179-179
Large diffs are not rendered by default.

Sources/code-security/Types.swift

+2,160-2,071
Large diffs are not rendered by default.

Sources/codes-of-conduct/Client.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public struct Client: APIProtocol {
4444
///
4545
/// - Remark: HTTP `GET /codes_of_conduct`.
4646
/// - Remark: Generated from `#/paths//codes_of_conduct/get(codes-of-conduct/get-all-codes-of-conduct)`.
47-
public func codes_hyphen_of_hyphen_conduct_sol_get_hyphen_all_hyphen_codes_hyphen_of_hyphen_conduct(_ input: Operations.codes_hyphen_of_hyphen_conduct_sol_get_hyphen_all_hyphen_codes_hyphen_of_hyphen_conduct.Input) async throws -> Operations.codes_hyphen_of_hyphen_conduct_sol_get_hyphen_all_hyphen_codes_hyphen_of_hyphen_conduct.Output {
47+
public func codesOfConductGetAllCodesOfConduct(_ input: Operations.CodesOfConductGetAllCodesOfConduct.Input) async throws -> Operations.CodesOfConductGetAllCodesOfConduct.Output {
4848
try await client.send(
4949
input: input,
50-
forOperation: Operations.codes_hyphen_of_hyphen_conduct_sol_get_hyphen_all_hyphen_codes_hyphen_of_hyphen_conduct.id,
50+
forOperation: Operations.CodesOfConductGetAllCodesOfConduct.id,
5151
serializer: { input in
5252
let path = try converter.renderedPath(
5353
template: "/codes_of_conduct",
@@ -68,7 +68,7 @@ public struct Client: APIProtocol {
6868
switch response.status.code {
6969
case 200:
7070
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
71-
let body: Operations.codes_hyphen_of_hyphen_conduct_sol_get_hyphen_all_hyphen_codes_hyphen_of_hyphen_conduct.Output.Ok.Body
71+
let body: Operations.CodesOfConductGetAllCodesOfConduct.Output.Ok.Body
7272
let chosenContentType = try converter.bestContentType(
7373
received: contentType,
7474
options: [
@@ -78,7 +78,7 @@ public struct Client: APIProtocol {
7878
switch chosenContentType {
7979
case "application/json":
8080
body = try await converter.getResponseBodyAsJSON(
81-
[Components.Schemas.code_hyphen_of_hyphen_conduct].self,
81+
[Components.Schemas.CodeOfConduct].self,
8282
from: responseBody,
8383
transforming: { value in
8484
.json(value)
@@ -108,10 +108,10 @@ public struct Client: APIProtocol {
108108
///
109109
/// - Remark: HTTP `GET /codes_of_conduct/{key}`.
110110
/// - Remark: Generated from `#/paths//codes_of_conduct/{key}/get(codes-of-conduct/get-conduct-code)`.
111-
public func codes_hyphen_of_hyphen_conduct_sol_get_hyphen_conduct_hyphen_code(_ input: Operations.codes_hyphen_of_hyphen_conduct_sol_get_hyphen_conduct_hyphen_code.Input) async throws -> Operations.codes_hyphen_of_hyphen_conduct_sol_get_hyphen_conduct_hyphen_code.Output {
111+
public func codesOfConductGetConductCode(_ input: Operations.CodesOfConductGetConductCode.Input) async throws -> Operations.CodesOfConductGetConductCode.Output {
112112
try await client.send(
113113
input: input,
114-
forOperation: Operations.codes_hyphen_of_hyphen_conduct_sol_get_hyphen_conduct_hyphen_code.id,
114+
forOperation: Operations.CodesOfConductGetConductCode.id,
115115
serializer: { input in
116116
let path = try converter.renderedPath(
117117
template: "/codes_of_conduct/{}",
@@ -134,7 +134,7 @@ public struct Client: APIProtocol {
134134
switch response.status.code {
135135
case 200:
136136
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
137-
let body: Operations.codes_hyphen_of_hyphen_conduct_sol_get_hyphen_conduct_hyphen_code.Output.Ok.Body
137+
let body: Operations.CodesOfConductGetConductCode.Output.Ok.Body
138138
let chosenContentType = try converter.bestContentType(
139139
received: contentType,
140140
options: [
@@ -144,7 +144,7 @@ public struct Client: APIProtocol {
144144
switch chosenContentType {
145145
case "application/json":
146146
body = try await converter.getResponseBodyAsJSON(
147-
Components.Schemas.code_hyphen_of_hyphen_conduct.self,
147+
Components.Schemas.CodeOfConduct.self,
148148
from: responseBody,
149149
transforming: { value in
150150
.json(value)
@@ -156,7 +156,7 @@ public struct Client: APIProtocol {
156156
return .ok(.init(body: body))
157157
case 404:
158158
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
159-
let body: Components.Responses.not_found.Body
159+
let body: Components.Responses.NotFound.Body
160160
let chosenContentType = try converter.bestContentType(
161161
received: contentType,
162162
options: [
@@ -166,7 +166,7 @@ public struct Client: APIProtocol {
166166
switch chosenContentType {
167167
case "application/json":
168168
body = try await converter.getResponseBodyAsJSON(
169-
Components.Schemas.basic_hyphen_error.self,
169+
Components.Schemas.BasicError.self,
170170
from: responseBody,
171171
transforming: { value in
172172
.json(value)

0 commit comments

Comments
 (0)