Closed jbelkins closed 11 months ago
Due to a recent model change in the AWSIoTFleetwise service, the following compile error (and a couple similar ones) occurs:
AWSIoTFleetwise
/__w/aws-sdk-swift/aws-sdk-swift/Sources/Services/AWSIoTFleetWise/models/Models.swift:8481:19: error: value type 'IoTFleetWiseClientTypes.MessageSignal' has infinite size public struct MessageSignal: Swift.Equatable { ^ /__w/aws-sdk-swift/aws-sdk-swift/Sources/Services/AWSIoTFleetWise/models/Models.swift:8484:20: note: cycle beginning here: IoTFleetWiseClientTypes.StructuredMessage? -> (some(_:): IoTFleetWiseClientTypes.StructuredMessage) -> (structuredmessagelistdefinition(_:): IoTFleetWiseClientTypes.StructuredMessageListDefinition) -> (memberType: IoTFleetWiseClientTypes.StructuredMessage?) public var structuredMessage: IoTFleetWiseClientTypes.StructuredMessage? ^ /__w/aws-sdk-swift/aws-sdk-swift/Sources/Services/AWSIoTFleetWise/models/Models.swift:10662:17: error: recursive enum 'IoTFleetWiseClientTypes.StructuredMessage' is not marked 'indirect' public enum StructuredMessage: Swift.Equatable { ^ indirect /__w/aws-sdk-swift/aws-sdk-swift/Sources/Services/AWSIoTFleetWise/models/Models.swift:10666:14: note: cycle beginning here: IoTFleetWiseClientTypes.StructuredMessageListDefinition -> (memberType: IoTFleetWiseClientTypes.StructuredMessage?) -> (some(_:): IoTFleetWiseClientTypes.StructuredMessage) case structuredmessagelistdefinition(IoTFleetWiseClientTypes.StructuredMessageListDefinition) ^ /__w/aws-sdk-swift/aws-sdk-swift/Sources/Services/AWSIoTFleetWise/models/Models.swift:10701:19: error: value type 'IoTFleetWiseClientTypes.StructuredMessageFieldNameAndDataTypePair' has infinite size public struct StructuredMessageFieldNameAndDataTypePair: Swift.Equatable { ^ /__w/aws-sdk-swift/aws-sdk-swift/Sources/Services/AWSIoTFleetWise/models/Models.swift:10704:20: note: cycle beginning here: IoTFleetWiseClientTypes.StructuredMessage? -> (some(_:): IoTFleetWiseClientTypes.StructuredMessage) -> (structuredmessagelistdefinition(_:): IoTFleetWiseClientTypes.StructuredMessageListDefinition) -> (memberType: IoTFleetWiseClientTypes.StructuredMessage?) public var dataType: IoTFleetWiseClientTypes.StructuredMessage? ^ /__w/aws-sdk-swift/aws-sdk-swift/Sources/Services/AWSIoTFleetWise/models/Models.swift:10768:20: error: value type 'IoTFleetWiseClientTypes.StructuredMessageListDefinition' cannot have a stored property that recursively contains it public var memberType: IoTFleetWiseClientTypes.StructuredMessage? ^ /__w/aws-sdk-swift/aws-sdk-swift/Sources/Services/AWSIoTFleetWise/models/Models.swift:10768:20: note: cycle beginning here: IoTFleetWiseClientTypes.StructuredMessage? -> (some(_:): IoTFleetWiseClientTypes.StructuredMessage) -> (structuredmessagelistdefinition(_:): IoTFleetWiseClientTypes.StructuredMessageListDefinition) public var memberType: IoTFleetWiseClientTypes.StructuredMessage? ^
Smithy permits such a structure. The rules on recursive models are described here: https://smithy.io/2.0/spec/aggregate-types.html#recursive-shape-definitions
The failure is due to the use of recursive enumerations, which are permitted but not yet supported by the Swift SDK.
This is already a known issue, tracked here in the form of a failed / disabled protocol test: https://github.com/awslabs/aws-sdk-swift/issues/1096
Recursive enums should compile successfully, and associated protocol tests should pass.
Compile fails with messages similar to above when recursive enums are modeled.
Pull latest models using the codegen/sdk-codegen/scripts/updatemodels.sh script Code-generate the SDK Attempt to build the AWSIoTFleetwise service
codegen/sdk-codegen/scripts/updatemodels.sh
Add recursion detection to enums, add the indirect keyword when appropriate
indirect
No response
Latest / main
Latest
Released in AWS SDK for Swift 0.32.0
Describe the bug
Due to a recent model change in the
AWSIoTFleetwise
service, the following compile error (and a couple similar ones) occurs:Smithy permits such a structure. The rules on recursive models are described here: https://smithy.io/2.0/spec/aggregate-types.html#recursive-shape-definitions
The failure is due to the use of recursive enumerations, which are permitted but not yet supported by the Swift SDK.
This is already a known issue, tracked here in the form of a failed / disabled protocol test: https://github.com/awslabs/aws-sdk-swift/issues/1096
Expected Behavior
Recursive enums should compile successfully, and associated protocol tests should pass.
Current Behavior
Compile fails with messages similar to above when recursive enums are modeled.
Reproduction Steps
Pull latest models using the
codegen/sdk-codegen/scripts/updatemodels.sh
script Code-generate the SDK Attempt to build theAWSIoTFleetwise
servicePossible Solution
Add recursion detection to enums, add the
indirect
keyword when appropriateAdditional Information/Context
No response
AWS SWIFT SDK version used
Latest / main
Compiler and Version used
Latest
Operating System and version
Latest