diff --git a/Package.resolved b/Package.resolved index 6bd7d2e..31c8f2a 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/amzn/openapi-swift-code-generate.git", "state": { "branch": null, - "revision": "f724141e19f151197b283ffe05acd7fc691f66d0", - "version": "1.0.0-beta.1" + "revision": "4210a8db0c2dc1e78bae9e302165c448d2ee361e", + "version": "1.0.0-rc.1" } }, { @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/amzn/service-model-swift-code-generate.git", "state": { "branch": null, - "revision": "42c354dc16893d30d602bd24f8f570f20fc6206a", - "version": "3.0.0-rc.1" + "revision": "3cacd62f7290554185ffcf839ec75c4ee2584d8e", + "version": "3.0.0-rc.2" } }, { @@ -42,8 +42,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser", "state": { "branch": null, - "revision": "9f39744e025c7d377987f30b03770805dcb0bcd1", - "version": "1.1.4" + "revision": "fddd1c00396eed152c45a46bea9f47b98e59301d", + "version": "1.2.0" } }, { diff --git a/Package.swift b/Package.swift index 9a9cbae..9f1d8d2 100644 --- a/Package.swift +++ b/Package.swift @@ -47,9 +47,9 @@ let package = Package( targets: ["APIGatewaySwiftGenerateClient"]), ], dependencies: [ - .package(url: "https://github.com/amzn/service-model-swift-code-generate.git", from: "3.0.0-rc.1"), + .package(url: "https://github.com/amzn/service-model-swift-code-generate.git", from: "3.0.0-rc.2"), .package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"), - .package(url: "https://github.com/amzn/openapi-swift-code-generate.git", from: "1.0.0-beta.1"), + .package(url: "https://github.com/amzn/openapi-swift-code-generate.git", from: "1.0.0-rc.1"), ], targets: [ .plugin( diff --git a/Sources/APIGatewayClientGenerate/APIGatewayClientSwiftCodeGen.swift b/Sources/APIGatewayClientGenerate/APIGatewayClientSwiftCodeGen.swift index 36545a3..530a614 100644 --- a/Sources/APIGatewayClientGenerate/APIGatewayClientSwiftCodeGen.swift +++ b/Sources/APIGatewayClientGenerate/APIGatewayClientSwiftCodeGen.swift @@ -15,7 +15,7 @@ enum ModelFormat: String, Codable { struct APIGatewayClientSwiftCodeGen: Decodable { let modelFormat: ModelFormat? let baseName: String - let modelOverride: ModelOverride? + let modelOverride: ModelOverride? let httpClientConfiguration: HttpClientConfiguration? let shapeProtocols: CodeGenFeatureStatus? let eventLoopFutureClientAPIs: CodeGenFeatureStatus? diff --git a/Sources/APIGatewayClientModelGenerate/APIGatewayClientCodeGeneration.swift b/Sources/APIGatewayClientModelGenerate/APIGatewayClientCodeGeneration.swift index aeb0159..cb0e444 100644 --- a/Sources/APIGatewayClientModelGenerate/APIGatewayClientCodeGeneration.swift +++ b/Sources/APIGatewayClientModelGenerate/APIGatewayClientCodeGeneration.swift @@ -37,7 +37,7 @@ public struct APIGatewayClientCodeGeneration { modelTargetName: String, clientTargetName: String, customizations: CodeGenerationCustomizations, applicationDescription: ApplicationDescription, - modelOverride: ModelOverride?) throws + modelOverride: ModelOverride?) throws -> ModelType { let targetSupport = ModelAndClientTargetSupport(modelTargetName: modelTargetName, clientTargetName: clientTargetName) @@ -64,7 +64,7 @@ public struct APIGatewayClientCodeGeneration { modelTargetName: String, clientTargetName: String, customizations: CodeGenerationCustomizations, applicationDescription: ApplicationDescription, - modelOverride: ModelOverride?) throws { + modelOverride: ModelOverride?) throws { let targetSupport = ModelAndClientTargetSupport(modelTargetName: modelTargetName, clientTargetName: clientTargetName) @@ -90,7 +90,7 @@ public struct APIGatewayClientCodeGeneration { modelTargetName: String, clientTargetName: String, customizations: CodeGenerationCustomizations, applicationDescription: ApplicationDescription, - modelOverride: ModelOverride?) throws { + modelOverride: ModelOverride?) throws { let targetSupport = ModelAndClientTargetSupport(modelTargetName: modelTargetName, clientTargetName: clientTargetName) @@ -160,12 +160,12 @@ struct APIGatewayClientCodeGenerator { extension ServiceModelCodeGenerator where TargetSupportType: ModelTargetSupport & ClientTargetSupport { - func generateFromModel(serviceModel: ModelType, - generationType: GenerationType, - asyncAwaitAPIs: CodeGenFeatureStatus, - eventLoopFutureClientAPIs: CodeGenFeatureStatus, - minimumCompilerSupport: MinimumCompilerSupport, - clientConfigurationType: ClientConfigurationType) throws { + func generateFromModel(serviceModel: ModelType, + generationType: GenerationType, + asyncAwaitAPIs: CodeGenFeatureStatus, + eventLoopFutureClientAPIs: CodeGenFeatureStatus, + minimumCompilerSupport: MinimumCompilerSupport, + clientConfigurationType: ClientConfigurationType) throws { switch generationType { case .codeGenModel: let awsModelErrorsDelegate = APIGatewayClientModelErrorsDelegate() @@ -176,24 +176,24 @@ extension ServiceModelCodeGenerator where TargetSupportType: ModelTargetSupport generateModelErrors(delegate: awsModelErrorsDelegate) generateDefaultInstances(generationType: .internalTypes) case .codeGenClient: - let clientProtocolDelegate = ClientProtocolDelegate( + let clientProtocolDelegate = ClientProtocolDelegate( baseName: applicationDescription.baseName, asyncAwaitAPIs: asyncAwaitAPIs, eventLoopFutureClientAPIs: eventLoopFutureClientAPIs, minimumCompilerSupport: minimumCompilerSupport) - let mockClientDelegate = MockAWSClientDelegate( + let mockClientDelegate = MockAWSClientDelegate( baseName: applicationDescription.baseName, isThrowingMock: false, asyncAwaitAPIs: asyncAwaitAPIs, eventLoopFutureClientAPIs: eventLoopFutureClientAPIs, minimumCompilerSupport: minimumCompilerSupport) - let throwingClientDelegate = MockAWSClientDelegate( + let throwingClientDelegate = MockAWSClientDelegate( baseName: applicationDescription.baseName, isThrowingMock: true, asyncAwaitAPIs: asyncAwaitAPIs, eventLoopFutureClientAPIs: eventLoopFutureClientAPIs, minimumCompilerSupport: minimumCompilerSupport) - let apiGatewayClientDelegate = APIGatewayClientDelegate( + let apiGatewayClientDelegate = APIGatewayClientDelegate( baseName: applicationDescription.baseName, asyncAwaitAPIs: asyncAwaitAPIs, eventLoopFutureClientAPIs: eventLoopFutureClientAPIs, diff --git a/Sources/CoralToJSONServiceModel/CoralToJSONServiceModel.swift b/Sources/CoralToJSONServiceModel/CoralToJSONServiceModel.swift index 671e2be..787811d 100644 --- a/Sources/CoralToJSONServiceModel/CoralToJSONServiceModel.swift +++ b/Sources/CoralToJSONServiceModel/CoralToJSONServiceModel.swift @@ -295,7 +295,7 @@ public struct CoralToJSONServiceModel: Decodable { /// Use CoralToJSONModel as a ServiceModel extension CoralToJSONServiceModel: ServiceModel { - public static func create(data: Data, modelFormat: ModelFormat, modelOverride: ModelOverride?) throws -> CoralToJSONServiceModel { + public static func create(data: Data, modelFormat: ModelFormat, modelOverride: ModelOverride?) throws -> CoralToJSONServiceModel { let decoder = JSONDecoder() return try decoder.decode(CoralToJSONServiceModel.self, from: data) diff --git a/Sources/SmokeAWSGenerate/CloudFormationConfiguration.swift b/Sources/SmokeAWSGenerate/CloudFormationConfiguration.swift index f3b97bc..e990aa2 100644 --- a/Sources/SmokeAWSGenerate/CloudFormationConfiguration.swift +++ b/Sources/SmokeAWSGenerate/CloudFormationConfiguration.swift @@ -38,7 +38,7 @@ private let additionalErrors: Set = [ "ValidationError"] internal struct CloudFormationConfiguration { - static let modelOverride = ModelOverride(enumerations: + static let modelOverride = ModelOverride(enumerations: EnumerationNaming(usingUpperCamelCase: ["ChangeSource", "ChangeAction", "ChangeType", "EvaluationType", "HandlerErrorCode", "Replacement", "RequiresRecreation", "ResourceAttribute"]), additionalErrors: additionalErrors) diff --git a/Sources/SmokeAWSGenerate/CloudwatchConfiguration.swift b/Sources/SmokeAWSGenerate/CloudwatchConfiguration.swift index c239ec6..57b03cb 100644 --- a/Sources/SmokeAWSGenerate/CloudwatchConfiguration.swift +++ b/Sources/SmokeAWSGenerate/CloudwatchConfiguration.swift @@ -19,7 +19,7 @@ import Foundation import ServiceModelEntities internal struct CloudwatchConfiguration { - static let modelOverride = ModelOverride(fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) + static let modelOverride = ModelOverride(fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) static let httpClientConfiguration = HttpClientConfiguration( retryOnUnknownError: true, diff --git a/Sources/SmokeAWSGenerate/CodeBuildConfiguration.swift b/Sources/SmokeAWSGenerate/CodeBuildConfiguration.swift index dc3a97c..1a00926 100644 --- a/Sources/SmokeAWSGenerate/CodeBuildConfiguration.swift +++ b/Sources/SmokeAWSGenerate/CodeBuildConfiguration.swift @@ -19,7 +19,7 @@ import Foundation import ServiceModelEntities internal struct CodeBuildConfiguration { - static let modelOverride = ModelOverride(matchCase: []) + static let modelOverride = ModelOverride(matchCase: []) static let httpClientConfiguration = HttpClientConfiguration( retryOnUnknownError: true, diff --git a/Sources/SmokeAWSGenerate/CodePipelineConfiguration.swift b/Sources/SmokeAWSGenerate/CodePipelineConfiguration.swift index 01f2868..297e92b 100644 --- a/Sources/SmokeAWSGenerate/CodePipelineConfiguration.swift +++ b/Sources/SmokeAWSGenerate/CodePipelineConfiguration.swift @@ -19,7 +19,7 @@ import Foundation import ServiceModelEntities internal struct CodePipelineConfiguration { - static let modelOverride = ModelOverride( + static let modelOverride = ModelOverride( enumerations: EnumerationNaming(usingUpperCamelCase: ["ActionConfigurationPropertyType", "ActionExecutionStatus", "ActionOwner.ThirdParty", diff --git a/Sources/SmokeAWSGenerate/DynamoDBConfiguration.swift b/Sources/SmokeAWSGenerate/DynamoDBConfiguration.swift index 998ad0c..28c9858 100644 --- a/Sources/SmokeAWSGenerate/DynamoDBConfiguration.swift +++ b/Sources/SmokeAWSGenerate/DynamoDBConfiguration.swift @@ -19,8 +19,8 @@ import Foundation import ServiceModelEntities internal struct DynamoDBConfiguration { - static let modelOverride = ModelOverride(matchCase: ["AttributeValue"], - fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) + static let modelOverride = ModelOverride(matchCase: ["AttributeValue"], + fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) static let httpClientConfiguration = HttpClientConfiguration( retryOnUnknownError: true, diff --git a/Sources/SmokeAWSGenerate/EC2Configuration.swift b/Sources/SmokeAWSGenerate/EC2Configuration.swift index 40a635b..a3a526a 100644 --- a/Sources/SmokeAWSGenerate/EC2Configuration.swift +++ b/Sources/SmokeAWSGenerate/EC2Configuration.swift @@ -371,7 +371,7 @@ private let additionalErrors: Set = [ "Unavailable"] internal struct EC2Configuration { - static let modelOverride = ModelOverride( + static let modelOverride = ModelOverride( fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride], additionalErrors: additionalErrors) diff --git a/Sources/SmokeAWSGenerate/ECRConfiguration.swift b/Sources/SmokeAWSGenerate/ECRConfiguration.swift index 6b02ac3..75a1bae 100644 --- a/Sources/SmokeAWSGenerate/ECRConfiguration.swift +++ b/Sources/SmokeAWSGenerate/ECRConfiguration.swift @@ -20,7 +20,7 @@ import ServiceModelEntities internal struct ECRConfiguration { - static let modelOverride = ModelOverride( + static let modelOverride = ModelOverride( enumerations: EnumerationNaming(usingUpperCamelCase: ["ImageFailureCode", "LayerFailureCode"]), fieldRawTypeOverride: [Fields.timestamp.typeDescription: CommonConfiguration.longDateOverride]) diff --git a/Sources/SmokeAWSGenerate/ECSConfiguration.swift b/Sources/SmokeAWSGenerate/ECSConfiguration.swift index 46fac96..93a4d5e 100644 --- a/Sources/SmokeAWSGenerate/ECSConfiguration.swift +++ b/Sources/SmokeAWSGenerate/ECSConfiguration.swift @@ -19,7 +19,7 @@ import Foundation import ServiceModelEntities internal struct ECSConfiguration { - static let modelOverride = ModelOverride(fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) + static let modelOverride = ModelOverride(fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) static let httpClientConfiguration = HttpClientConfiguration( retryOnUnknownError: true, diff --git a/Sources/SmokeAWSGenerate/RDSConfiguration.swift b/Sources/SmokeAWSGenerate/RDSConfiguration.swift index 62c2cf4..b6d7020 100644 --- a/Sources/SmokeAWSGenerate/RDSConfiguration.swift +++ b/Sources/SmokeAWSGenerate/RDSConfiguration.swift @@ -19,8 +19,8 @@ import Foundation import ServiceModelEntities internal struct RDSConfiguration { - static let modelOverride = ModelOverride(matchCase: ["AttributeValue"], - fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) + static let modelOverride = ModelOverride(matchCase: ["AttributeValue"], + fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) static let httpClientConfiguration = HttpClientConfiguration( retryOnUnknownError: true, diff --git a/Sources/SmokeAWSGenerate/RDSDataConfiguration.swift b/Sources/SmokeAWSGenerate/RDSDataConfiguration.swift index 62d974e..65caa97 100644 --- a/Sources/SmokeAWSGenerate/RDSDataConfiguration.swift +++ b/Sources/SmokeAWSGenerate/RDSDataConfiguration.swift @@ -19,7 +19,7 @@ import Foundation import ServiceModelEntities internal struct RDSDataConfiguration { - static let modelOverride = ModelOverride(fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) + static let modelOverride = ModelOverride(fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) static let httpClientConfiguration = HttpClientConfiguration( retryOnUnknownError: true, diff --git a/Sources/SmokeAWSGenerate/S3Configuration.swift b/Sources/SmokeAWSGenerate/S3Configuration.swift index a39d313..8aa9366 100644 --- a/Sources/SmokeAWSGenerate/S3Configuration.swift +++ b/Sources/SmokeAWSGenerate/S3Configuration.swift @@ -30,7 +30,7 @@ internal struct S3Configuration { retriableUnknownErrors: [], additionalClients: ["dataHttpClient": additionalHttpClient]) - static let modelOverride = ModelOverride(enumerations: + static let modelOverride = ModelOverride(enumerations: EnumerationNaming(usingUpperCamelCase: ["Event"]), fieldRawTypeOverride: ["Long": CommonConfiguration.intOverride]) diff --git a/Sources/SmokeAWSGenerate/SNSConfiguration.swift b/Sources/SmokeAWSGenerate/SNSConfiguration.swift index 5f669e7..a72090f 100644 --- a/Sources/SmokeAWSGenerate/SNSConfiguration.swift +++ b/Sources/SmokeAWSGenerate/SNSConfiguration.swift @@ -19,7 +19,7 @@ import Foundation import ServiceModelEntities internal struct SNSConfiguration { - static let modelOverride = ModelOverride( + static let modelOverride = ModelOverride( codingKeyOverrides: ["AuthorizationErrorException.message": "Message", "EndpointDisabledException.message": "Message", "FilterPolicyLimitExceededException.message": "Message", diff --git a/Sources/SmokeAWSGenerate/SimpleQueueConfiguration.swift b/Sources/SmokeAWSGenerate/SimpleQueueConfiguration.swift index 729acb5..c631dd8 100644 --- a/Sources/SmokeAWSGenerate/SimpleQueueConfiguration.swift +++ b/Sources/SmokeAWSGenerate/SimpleQueueConfiguration.swift @@ -42,7 +42,7 @@ internal struct SimpleQueueConfiguration { "TagQueue": overrideInputDescription, "UntagQueue": overrideInputDescription] - static let modelOverride = ModelOverride( + static let modelOverride = ModelOverride( operationInputOverrides: operationInputOverrides, codingKeyOverrides: ["ReceiveMessageResult.Messages": "Message", "ChangeMessageVisibilityBatchRequest.Entries": "ChangeMessageVisibilityBatchRequestEntry", diff --git a/Sources/SmokeAWSGenerate/SimpleWorkflowConfiguration.swift b/Sources/SmokeAWSGenerate/SimpleWorkflowConfiguration.swift index 5380460..bc3927d 100644 --- a/Sources/SmokeAWSGenerate/SimpleWorkflowConfiguration.swift +++ b/Sources/SmokeAWSGenerate/SimpleWorkflowConfiguration.swift @@ -19,7 +19,7 @@ import Foundation import ServiceModelEntities internal struct SimpleWorkflowConfiguration { - static let modelOverride = ModelOverride( + static let modelOverride = ModelOverride( fieldRawTypeOverride: [Fields.timestamp.typeDescription: CommonConfiguration.integerDateOverride, "Long": CommonConfiguration.intOverride]) diff --git a/Sources/SmokeAWSGenerate/StepFunctionsConfiguration.swift b/Sources/SmokeAWSGenerate/StepFunctionsConfiguration.swift index 396b4e1..1cc58b3 100644 --- a/Sources/SmokeAWSGenerate/StepFunctionsConfiguration.swift +++ b/Sources/SmokeAWSGenerate/StepFunctionsConfiguration.swift @@ -19,7 +19,7 @@ import Foundation import ServiceModelEntities internal struct StepFunctionsConfiguration { - static let modelOverride = ModelOverride( + static let modelOverride = ModelOverride( enumerations: EnumerationNaming(usingUpperCamelCase: ["DecisionType", "EventType", "HistoryEventType"]), fieldRawTypeOverride: diff --git a/Sources/SmokeAWSGenerate/main.swift b/Sources/SmokeAWSGenerate/main.swift index 9245df7..59fa435 100644 --- a/Sources/SmokeAWSGenerate/main.swift +++ b/Sources/SmokeAWSGenerate/main.swift @@ -246,7 +246,7 @@ struct ServiceModelDetails { let serviceName: String let serviceVersion: String let baseName: String - let modelOverride: ModelOverride? + let modelOverride: ModelOverride? let httpClientConfiguration: HttpClientConfiguration let signAllHeaders: Bool } diff --git a/Sources/SmokeAWSModelGenerate/APIGatewayClientDelegate.swift b/Sources/SmokeAWSModelGenerate/APIGatewayClientDelegate.swift index 4d7b2ff..7e21569 100644 --- a/Sources/SmokeAWSModelGenerate/APIGatewayClientDelegate.swift +++ b/Sources/SmokeAWSModelGenerate/APIGatewayClientDelegate.swift @@ -23,7 +23,7 @@ import ServiceModelEntities A ModelClientDelegate that can be used to generate an API Gateway Client from a Service Model. */ -public struct APIGatewayClientDelegate: ModelClientDelegate +public struct APIGatewayClientDelegate: ModelClientDelegate where TargetSupportType: ModelTargetSupport { public let clientType: ClientType public let baseName: String @@ -74,7 +74,7 @@ where TargetSupportType: ModelTargetSupport { self.defaultInvocationTraceContext = defaultInvocationTraceContext } - public func addTypeDescription(codeGenerator: ServiceModelCodeGenerator, + public func addTypeDescription(codeGenerator: ServiceModelCodeGenerator, delegate: Self, fileBuilder: FileBuilder, entityType: ClientEntityType) { @@ -98,7 +98,7 @@ where TargetSupportType: ModelTargetSupport { } } - public func addCustomFileHeader(codeGenerator: ServiceModelCodeGenerator, + public func addCustomFileHeader(codeGenerator: ServiceModelCodeGenerator, delegate: Self, fileBuilder: FileBuilder, fileType: ClientFileType) { @@ -106,7 +106,7 @@ where TargetSupportType: ModelTargetSupport { defaultInvocationTraceContext: self.defaultInvocationTraceContext) } - public func addCommonFunctions(codeGenerator: ServiceModelCodeGenerator, + public func addCommonFunctions(codeGenerator: ServiceModelCodeGenerator, delegate: Self, fileBuilder: FileBuilder, sortedOperations: [(String, OperationDescription)], @@ -129,7 +129,7 @@ where TargetSupportType: ModelTargetSupport { entityType: entityType) } - public func addOperationBody(codeGenerator: ServiceModelCodeGenerator, + public func addOperationBody(codeGenerator: ServiceModelCodeGenerator, delegate: Self, fileBuilder: FileBuilder, invokeType: InvokeType, operationName: String, @@ -157,7 +157,7 @@ where TargetSupportType: ModelTargetSupport { private func addAPIGatewayClientOperationBody( operationName: String, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, fileBuilder: FileBuilder, function: APIGatewayClientFunction, httpVerb: String, diff --git a/Sources/SmokeAWSModelGenerate/AWSClientDelegate+addAWSClientOperationBody.swift b/Sources/SmokeAWSModelGenerate/AWSClientDelegate+addAWSClientOperationBody.swift index 32ddcee..2b546a0 100644 --- a/Sources/SmokeAWSModelGenerate/AWSClientDelegate+addAWSClientOperationBody.swift +++ b/Sources/SmokeAWSModelGenerate/AWSClientDelegate+addAWSClientOperationBody.swift @@ -23,7 +23,7 @@ internal extension AWSClientDelegate { func addAWSClientOperationBody( name: String, fileBuilder: FileBuilder, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, function: AWSClientFunction, http: (verb: String, url: String), invokeType: InvokeType, signAllHeaders: Bool) { diff --git a/Sources/SmokeAWSModelGenerate/AWSClientDelegate+addAWSClientQueryOperationBody.swift b/Sources/SmokeAWSModelGenerate/AWSClientDelegate+addAWSClientQueryOperationBody.swift index f0beda0..9ebaaec 100644 --- a/Sources/SmokeAWSModelGenerate/AWSClientDelegate+addAWSClientQueryOperationBody.swift +++ b/Sources/SmokeAWSModelGenerate/AWSClientDelegate+addAWSClientQueryOperationBody.swift @@ -23,7 +23,7 @@ internal extension AWSClientDelegate { func addAWSClientQueryOperationBody( name: String, fileBuilder: FileBuilder, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, function: AWSClientFunction, http: (verb: String, url: String), invokeType: InvokeType, diff --git a/Sources/SmokeAWSModelGenerate/AWSClientDelegate.swift b/Sources/SmokeAWSModelGenerate/AWSClientDelegate.swift index 57ddd89..cc3fc86 100644 --- a/Sources/SmokeAWSModelGenerate/AWSClientDelegate.swift +++ b/Sources/SmokeAWSModelGenerate/AWSClientDelegate.swift @@ -23,7 +23,7 @@ import ServiceModelEntities A ModelClientDelegate that can be used to generate an AWS Client from a Service Model. */ -public struct AWSClientDelegate: ModelClientDelegate +public struct AWSClientDelegate: ModelClientDelegate where TargetSupportType: ModelTargetSupport { public let clientType: ClientType public let clientAttributes: AWSClientAttributes @@ -71,7 +71,7 @@ where TargetSupportType: ModelTargetSupport { self.signAllHeaders = signAllHeaders } - public func addTypeDescription(codeGenerator: ServiceModelCodeGenerator, + public func addTypeDescription(codeGenerator: ServiceModelCodeGenerator, delegate: Self, fileBuilder: FileBuilder, entityType: ClientEntityType) { @@ -86,7 +86,7 @@ where TargetSupportType: ModelTargetSupport { } } - public func addCustomFileHeader(codeGenerator: ServiceModelCodeGenerator, + public func addCustomFileHeader(codeGenerator: ServiceModelCodeGenerator, delegate: Self, fileBuilder: FileBuilder, fileType: ClientFileType) { @@ -94,7 +94,7 @@ where TargetSupportType: ModelTargetSupport { defaultInvocationTraceContext: self.clientAttributes.defaultInvocationTraceContext) } - public func addCommonFunctions(codeGenerator: ServiceModelCodeGenerator, + public func addCommonFunctions(codeGenerator: ServiceModelCodeGenerator, delegate: Self, fileBuilder: FileBuilder, sortedOperations: [(String, OperationDescription)], @@ -109,7 +109,7 @@ where TargetSupportType: ModelTargetSupport { entityType: entityType) } - public func addOperationBody(codeGenerator: ServiceModelCodeGenerator, + public func addOperationBody(codeGenerator: ServiceModelCodeGenerator, delegate: Self, fileBuilder: FileBuilder, invokeType: InvokeType, diff --git a/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientDeinitializer.swift b/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientDeinitializer.swift index 46aa1ed..6f80c98 100644 --- a/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientDeinitializer.swift +++ b/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientDeinitializer.swift @@ -23,7 +23,7 @@ import CoralToJSONServiceModel extension ModelClientDelegate { func addAWSClientDeinitializer(fileBuilder: FileBuilder, baseName: String, clientAttributes: AWSClientAttributes, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, targetsAPIGateway: Bool, contentType: String, entityType: ClientEntityType) { @@ -77,7 +77,7 @@ extension ModelClientDelegate { private func addShutdownMethod(methodName: String, isAsync: Bool, fileBuilder: FileBuilder, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, entityType: ClientEntityType) { let httpClientConfiguration = codeGenerator.customizations.httpClientConfiguration diff --git a/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientFileHeader.swift b/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientFileHeader.swift index 95c1799..753180c 100644 --- a/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientFileHeader.swift +++ b/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientFileHeader.swift @@ -22,7 +22,7 @@ import ServiceModelGenerate import CoralToJSONServiceModel extension ModelClientDelegate where TargetSupportType: ModelTargetSupport { - func addAWSClientFileHeader(codeGenerator: ServiceModelCodeGenerator, + func addAWSClientFileHeader(codeGenerator: ServiceModelCodeGenerator, fileBuilder: FileBuilder, baseName: String, fileType: ClientFileType, defaultInvocationTraceContext: InvocationTraceContextDeclaration) { fileBuilder.appendLine(""" diff --git a/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientInitializer.swift b/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientInitializer.swift index da68be1..b08831b 100644 --- a/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientInitializer.swift +++ b/Sources/SmokeAWSModelGenerate/ModelClientDelegate+addAWSClientInitializer.swift @@ -31,7 +31,7 @@ public enum DelegateStatementType { extension ModelClientDelegate { func addAWSClientInitializerAndMembers(fileBuilder: FileBuilder, baseName: String, clientAttributes: AWSClientAttributes, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, targetsAPIGateway: Bool, contentType: String, sortedOperations: [(String, OperationDescription)], @@ -178,7 +178,7 @@ extension ModelClientDelegate { private func addAWSClientInitializer(fileBuilder: FileBuilder, baseName: String, clientAttributes: AWSClientAttributes, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, endpointDefault: String, regionDefault: String, regionAssignmentPostfix: String, targetsAPIGateway: Bool, contentType: String, contentTypeAssignment: String, targetAssignment: String, @@ -255,7 +255,7 @@ extension ModelClientDelegate { contentType: String, httpClientConfiguration: HttpClientConfiguration, baseName: String, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, regionAssignmentPostfix: String, targetAssignment: String, targetsAPIGateway: Bool, @@ -502,7 +502,7 @@ extension ModelClientDelegate { private func addAdditionalHttpClients( httpClientConfiguration: HttpClientConfiguration, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, fileBuilder: FileBuilder, initializerType: InitializerType, connectionTimeoutEqualityLine: String) { httpClientConfiguration.additionalClients?.forEach { (key, _) in @@ -611,7 +611,7 @@ extension ModelClientDelegate { contentType: String, baseName: String, httpClientConfiguration: HttpClientConfiguration, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, entityType: ClientEntityType) { if entityType.isClientImplementation || entityType.isGenerator { fileBuilder.appendLine(""" @@ -709,7 +709,7 @@ extension ModelClientDelegate { contentType: String, baseName: String, httpClientConfiguration: HttpClientConfiguration, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, targetsAPIGateway: Bool, entityType: ClientEntityType) { if entityType.isClientImplementation || entityType.isGenerator { @@ -811,7 +811,7 @@ extension ModelClientDelegate { fileBuilder: FileBuilder, baseName: String, httpClientConfiguration: HttpClientConfiguration, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, regionDefault: String, endpointDefault: String, targetsAPIGateway: Bool, @@ -992,7 +992,7 @@ extension ModelClientDelegate { public func addAWSClientGeneratorWithReporting( fileBuilder: FileBuilder, baseName: String, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, targetsAPIGateway: Bool, clientAttributes: AWSClientAttributes, contentType: String) { @@ -1006,7 +1006,7 @@ extension ModelClientDelegate { public func addAWSClientGeneratorWithReporting( fileBuilder: FileBuilder, baseName: String, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, targetsAPIGateway: Bool, contentType: String) { guard case .struct(let clientName, _, _) = clientType else { @@ -1066,7 +1066,7 @@ extension ModelClientDelegate { public func addAWSClientGeneratorWithAWSTraceContext( fileBuilder: FileBuilder, baseName: String, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, targetsAPIGateway: Bool, clientAttributes: AWSClientAttributes, contentType: String) { @@ -1081,7 +1081,7 @@ extension ModelClientDelegate { public func addAWSClientGeneratorWithLogger( fileBuilder: FileBuilder, baseName: String, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, targetsAPIGateway: Bool, invocationTraceContext: InvocationTraceContextDeclaration, contentType: String) { diff --git a/Sources/SmokeAWSModelGenerate/ModelClientDelegate+commonAWSFunctions.swift b/Sources/SmokeAWSModelGenerate/ModelClientDelegate+commonAWSFunctions.swift index d2da3af..06a43fc 100644 --- a/Sources/SmokeAWSModelGenerate/ModelClientDelegate+commonAWSFunctions.swift +++ b/Sources/SmokeAWSModelGenerate/ModelClientDelegate+commonAWSFunctions.swift @@ -24,7 +24,7 @@ import CoralToJSONServiceModel extension ModelClientDelegate { func addAWSClientCommonFunctions(fileBuilder: FileBuilder, baseName: String, clientAttributes: AWSClientAttributes, - codeGenerator: ServiceModelCodeGenerator, + codeGenerator: ServiceModelCodeGenerator, targetsAPIGateway: Bool, contentType: String, sortedOperations: [(String, OperationDescription)], diff --git a/Sources/SmokeAWSModelGenerate/SmokeAWSModelGenerate.swift b/Sources/SmokeAWSModelGenerate/SmokeAWSModelGenerate.swift index 626ed94..9d0b077 100644 --- a/Sources/SmokeAWSModelGenerate/SmokeAWSModelGenerate.swift +++ b/Sources/SmokeAWSModelGenerate/SmokeAWSModelGenerate.swift @@ -27,7 +27,7 @@ public struct SmokeAWSModelGenerate { modelFilePath: String, customizations: CodeGenerationCustomizations, applicationDescription: ApplicationDescription, - modelOverride: ModelOverride?, + modelOverride: ModelOverride?, signAllHeaders: Bool) throws -> CoralToJSONServiceModel { return try ServiceModelGenerate.generateFromModel( @@ -48,21 +48,22 @@ extension ServiceModelCodeGenerator where TargetSupportType: ModelTargetSupport func generateFromCoralToJSONServiceModel( coralToJSONServiceModel: CoralToJSONServiceModel, asyncAwaitAPIs: CodeGenFeatureStatus, - signAllHeaders: Bool) throws { + signAllHeaders: Bool) throws + where ModelType == CoralToJSONServiceModel { let awsClientAttributes = coralToJSONServiceModel.getAWSClientAttributes() - let clientProtocolDelegate = ClientProtocolDelegate( + let clientProtocolDelegate = ClientProtocolDelegate( baseName: applicationDescription.baseName, asyncAwaitAPIs: asyncAwaitAPIs) - let mockClientDelegate = MockAWSClientDelegate( + let mockClientDelegate = MockAWSClientDelegate( baseName: applicationDescription.baseName, isThrowingMock: false, asyncAwaitAPIs: asyncAwaitAPIs) - let throwingClientDelegate = MockAWSClientDelegate( + let throwingClientDelegate = MockAWSClientDelegate( baseName: applicationDescription.baseName, isThrowingMock: true, asyncAwaitAPIs: asyncAwaitAPIs) - let awsClientDelegate = AWSClientDelegate( + let awsClientDelegate = AWSClientDelegate( baseName: applicationDescription.baseName, clientAttributes: awsClientAttributes, signAllHeaders: signAllHeaders, @@ -88,7 +89,7 @@ extension ServiceModelCodeGenerator where TargetSupportType: ModelTargetSupport public extension ServiceModelCodeGenerator where TargetSupportType: ModelTargetSupport & ClientTargetSupport { func generateAWSClient(delegate: DelegateType, fileType: ClientFileType) - where DelegateType.TargetSupportType == TargetSupportType { + where DelegateType.TargetSupportType == TargetSupportType, DelegateType.ModelType == ModelType { let defaultTraceContextType = DefaultTraceContextType(typeName: "AWSClientInvocationTraceContext", importTargetName: "AWSHttp") generateClient(delegate: delegate, fileType: fileType, defaultTraceContextType: defaultTraceContextType)