Skip to content

Commit 42363d6

Browse files
authored
Merge pull request #28 from mattpolzin/fix-keyword-test-names
Escape some keywords in generated test namespaces
2 parents efbb5cb + 199a2b3 commit 42363d6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftGen/ApiTestPackageSwiftGen.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func swiftTypeName(from string: String) -> String {
281281

282282
func namespace(for path: OpenAPI.Path) -> String {
283283
return path.components
284-
.map(swiftTypeName)
284+
.map(TestFunctionName.swiftName)
285285
.joined(separator: ".")
286286
}
287287

@@ -539,7 +539,7 @@ func namespaceDecls(for routes: [ResolvedRoute]) -> [DeclNode] {
539539
var remainingPath = path.components.makeIterator()
540540

541541
func fillFrom(currentNode: inout DeclNode) {
542-
guard let next = remainingPath.next().map(swiftTypeName) else {
542+
guard let next = remainingPath.next().map(TestFunctionName.swiftName) else {
543543
return
544544
}
545545
var newNode = DeclNode(name: next, children: [])
@@ -550,7 +550,7 @@ func namespaceDecls(for routes: [ResolvedRoute]) -> [DeclNode] {
550550

551551
func step(currentNodes: inout [DeclNode]) {
552552

553-
guard let next = remainingPath.next().map(swiftTypeName) else {
553+
guard let next = remainingPath.next().map(TestFunctionName.swiftName) else {
554554
return
555555
}
556556

0 commit comments

Comments
 (0)