Skip to content

Commit ce91c22

Browse files
committed
Proposal update v1.1 - improved the handling of synthesized operationIds
1 parent c87190e commit ce91c22

File tree

1 file changed

+6
-0
lines changed
  • Sources/swift-openapi-generator/Documentation.docc/Proposals

1 file changed

+6
-0
lines changed

Sources/swift-openapi-generator/Documentation.docc/Proposals/SOAR-0013.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Introduce an alternative naming strategy for more idiomatic Swift identifiers, i
77
- Proposal: SOAR-0013
88
- Author(s): [Honza Dvorsky](https://github.com/czechboy0), [Si Beaumont](https://github.com/simonjbeaumont)
99
- Status: **In Review**
10+
- Versions:
11+
- v1.0 (2024-11-27): Initial version
12+
- v1.1 (2024-11-28): Also handle "/", "{", and "}" for better synthesized operation names
1013
- Issues:
1114
- [apple/swift-openapi-generator#112][issuePlugin]
1215
- [apple/swift-openapi-generator#107][issue1]
@@ -74,6 +77,7 @@ To get a sense for the proposed change, check out the table below that compares
7477
| `version 2.0` | `version_space_2_period_0` | `Version2_0` | `version2_0` |
7578
| `naïve café` | `naïve_space_café` | `NaïveCafé` | `naïveCafé` |
7679
| `__user` | `__user` | `__User` | `__user` |
80+
| `get/pets/{petId}` _Added in v1.1_ | `get_sol_pets_sol__lcub_petId_rcub_` | `Get_pets_petId` | `get_pets_petId` |
7781
| `order#123` | `order_num_123` | `order_num_123` | `order_num_123` |
7882

7983
Notice that in the last example, since the OpenAPI name contains the pound (`#`) character, the idiomatic naming strategy falls back to the defensive naming strategy. In all the other cases, however, the resulting names are more idiomatic Swift identifiers.
@@ -96,6 +100,8 @@ The idiomatic naming strategy (check out the current code [here][impl], look for
96100
- dashes (`-`, ASCII: `0x2d`)
97101
- underscores (`_`, ASCII: `0x5f`)
98102
- spaces (` `, ASCII: `0x20`)
103+
- slashes (`/`, ASCII: `0x2f`) _Added in v1.1_
104+
- curly braces (`{` and `}`, ASCII: `0x7b` and `0x7d`) _Added in v1.1_
99105

100106
> Note: We let [`Swift.String.isLetter`](https://developer.apple.com/documentation/swift/character/isletter) decide whether a character is a letter, which has the advantage of including letters in the non-ASCII range. Swift identifiers also support a [wide range](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure/#Identifiers) of alphanumeric characters.
101107

0 commit comments

Comments
 (0)