Skip to content

Commit 140f5c0

Browse files
committed
[Experiment] Optimistic naming strategy as opt-in
1 parent 7fcef1d commit 140f5c0

25 files changed

+589
-121
lines changed

Sources/_OpenAPIGeneratorCore/Config.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
public enum NamingStrategy: String, Sendable, Codable, Equatable {
16+
case defensive
17+
case optimistic
18+
}
19+
1520
/// A structure that contains configuration options for a single execution
1621
/// of the generator pipeline run.
1722
///
@@ -35,6 +40,10 @@ public struct Config: Sendable {
3540
/// Filter to apply to the OpenAPI document before generation.
3641
public var filter: DocumentFilter?
3742

43+
public var namingStrategy: NamingStrategy?
44+
45+
public var nameOverrides: [String: String]?
46+
3847
/// Additional pre-release features to enable.
3948
public var featureFlags: FeatureFlags
4049

@@ -50,12 +59,16 @@ public struct Config: Sendable {
5059
access: AccessModifier,
5160
additionalImports: [String] = [],
5261
filter: DocumentFilter? = nil,
62+
namingStrategy: NamingStrategy? = nil,
63+
nameOverrides: [String: String]? = nil,
5364
featureFlags: FeatureFlags = []
5465
) {
5566
self.mode = mode
5667
self.access = access
5768
self.additionalImports = additionalImports
5869
self.filter = filter
70+
self.namingStrategy = namingStrategy
71+
self.nameOverrides = nameOverrides
5972
self.featureFlags = featureFlags
6073
}
6174
}

Sources/_OpenAPIGeneratorCore/Translator/ClientTranslator/translateClientMethod.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ extension ClientFileTranslator {
145145
func translateClientMethod(_ description: OperationDescription) throws -> Declaration {
146146

147147
let operationTypeExpr = Expression.identifierType(.member(Constants.Operations.namespace))
148-
.dot(description.methodName)
148+
.dot(description.operationTypeName)
149149

150150
let operationArg = FunctionArgumentDescription(label: "forOperation", expression: operationTypeExpr.dot("id"))
151151
let inputArg = FunctionArgumentDescription(

0 commit comments

Comments
 (0)