From 495f2e1eeaec06c484a4c477feac47608f5d9d94 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Tue, 4 Nov 2025 15:23:33 -0600 Subject: [PATCH 1/9] Disable input/output serializers --- Sources/Smithy/Schema/Node.swift | 109 ++++++++++++++++++ Sources/Smithy/Schema/Prelude.swift | 85 ++++++++++++++ Sources/Smithy/Schema/Schema.swift | 34 ++++++ .../{Document => Schema}/ShapeType.swift | 0 .../swift/codegen/DirectedSwiftCodegen.kt | 1 + .../HTTPBindingProtocolGenerator.kt | 105 ++++++++++++++++- .../codegen/integration/ProtocolGenerator.kt | 2 + .../serde/schema/SchemaGenerator.kt | 76 ++++++++++++ .../serde/schema/SchemaShapeUtils.kt | 45 ++++++++ .../serde/schema/SwiftNodeUtils.kt | 44 +++++++ .../swiftmodules/SmithyReadWriteTypes.kt | 5 + .../swift/codegen/swiftmodules/SmithyTypes.kt | 30 ++++- .../swift/codegen/swiftmodules/SwiftTypes.kt | 1 + .../swift/codegen/utils/SchemaFileUtils.kt | 17 +++ 14 files changed, 548 insertions(+), 6 deletions(-) create mode 100644 Sources/Smithy/Schema/Node.swift create mode 100644 Sources/Smithy/Schema/Prelude.swift create mode 100644 Sources/Smithy/Schema/Schema.swift rename Sources/Smithy/{Document => Schema}/ShapeType.swift (100%) create mode 100644 smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt create mode 100644 smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt create mode 100644 smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SwiftNodeUtils.kt create mode 100644 smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/utils/SchemaFileUtils.kt diff --git a/Sources/Smithy/Schema/Node.swift b/Sources/Smithy/Schema/Node.swift new file mode 100644 index 000000000..55f2c8618 --- /dev/null +++ b/Sources/Smithy/Schema/Node.swift @@ -0,0 +1,109 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +/// Contains the value of a Smithy Node. +/// +/// Smithy node data is basically the same as the data that can be stored in JSON. +/// The root of a Smithy node may be of any case, i.e. unlike JSON, the root element is not limited to object or list. +/// +/// See the definition of node value in the Smithy spec: https://smithy.io/2.0/spec/model.html#node-values +public enum Node: Sendable { + case object([String: Node]) + case list([Node]) + case string(String) + case number(Double) + case boolean(Bool) + case null +} + +public extension Node { + + /// Returns the object dictionary if this Node is `.object`, else returns `nil`. + var object: [String: Node]? { + guard case .object(let value) = self else { return nil } + return value + } + + /// Returns the array of `Node` if this node is `.list`, else returns `nil`. + var list: [Node]? { + guard case .list(let value) = self else { return nil } + return value + } + + /// Returns the string if this node is `.string`, else returns `nil`. + var string: String? { + guard case .string(let value) = self else { return nil } + return value + } + + /// Returns the Double if this node is `.number`, else returns `nil`. + var number: Double? { + guard case .number(let value) = self else { return nil } + return value + } + + /// Returns the `Bool` value if this node is `.boolean`, else returns `nil`. + var boolean: Bool? { + guard case .boolean(let value) = self else { return nil } + return value + } + + /// Returns `true` if this node is `.null`, else returns `false`. + var null: Bool { + guard case .null = self else { return false } + return true + } +} + +extension Node: ExpressibleByDictionaryLiteral { + + public init(dictionaryLiteral elements: (String, Node)...) { + self = .object(Dictionary(uniqueKeysWithValues: elements)) + } +} + +extension Node: ExpressibleByArrayLiteral { + + public init(arrayLiteral elements: Node...) { + self = .list(elements) + } +} + +extension Node: ExpressibleByStringLiteral { + + public init(stringLiteral value: String) { + self = .string(value) + } +} + +extension Node: ExpressibleByIntegerLiteral { + + public init(integerLiteral value: IntegerLiteralType) { + self = .number(Double(value)) + } +} + +extension Node: ExpressibleByFloatLiteral { + + public init(floatLiteral value: FloatLiteralType) { + self = .number(Double(value)) + } +} + +extension Node: ExpressibleByBooleanLiteral { + + public init(booleanLiteral value: BooleanLiteralType) { + self = .boolean(value) + } +} + +extension Node: ExpressibleByNilLiteral { + + public init(nilLiteral: ()) { + self = .null + } +} diff --git a/Sources/Smithy/Schema/Prelude.swift b/Sources/Smithy/Schema/Prelude.swift new file mode 100644 index 000000000..79775e127 --- /dev/null +++ b/Sources/Smithy/Schema/Prelude.swift @@ -0,0 +1,85 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +// Below are schemas for all model shapes defined in the Smithy 2.0 prelude. +// Schemas for custom Smithy types may use these schemas in their definitions. + +public var unitSchema: Schema { + Schema(id: "smithy.api#Unit", type: .structure) +} + +public var booleanSchema: Schema { + Schema(id: "smithy.api#Boolean", type: .boolean) +} + +public var stringSchema: Schema { + Schema(id: "smithy.api#String", type: .string) +} + +public var integerSchema: Schema { + Schema(id: "smithy.api#Integer", type: .integer) +} + +public var blobSchema: Schema { + Schema(id: "smithy.api#Blob", type: .blob) +} + +public var timestampSchema: Schema { + Schema(id: "smithy.api#Timestamp", type: .timestamp) +} + +public var byteSchema: Schema { + Schema(id: "smithy.api#Byte", type: .byte) +} + +public var shortSchema: Schema { + Schema(id: "smithy.api#Short", type: .short) +} + +public var longSchema: Schema { + Schema(id: "smithy.api#Long", type: .long) +} + +public var floatSchema: Schema { + Schema(id: "smithy.api#Float", type: .float) +} + +public var doubleSchema: Schema { + Schema(id: "smithy.api#Double", type: .double) +} + +public var documentSchema: Schema { + Schema(id: "smithy.api#PrimitiveDocument", type: .document) +} + +public var primitiveBooleanSchema: Schema { + Schema(id: "smithy.api#PrimitiveBoolean", type: .boolean, traits: ["smithy.api#default": false]) +} + +public var primitiveIntegerSchema: Schema { + Schema(id: "smithy.api#PrimitiveInteger", type: .integer, traits: ["smithy.api#default": 0]) +} + +public var primitiveByteSchema: Schema { + Schema(id: "smithy.api#PrimitiveByte", type: .byte, traits: ["smithy.api#default": 0]) +} + +public var primitiveShortSchema: Schema { + Schema(id: "smithy.api#PrimitiveShort", type: .short, traits: ["smithy.api#default": 0]) +} + +public var primitiveLongSchema: Schema { + Schema(id: "smithy.api#PrimitiveLong", type: .long, traits: ["smithy.api#default": 0]) +} + +public var primitiveFloatSchema: Schema { + Schema(id: "smithy.api#PrimitiveFloat", type: .float, traits: ["smithy.api#default": 0]) +} + +public var primitiveDoubleSchema: Schema { + Schema(id: "smithy.api#PrimitiveDouble", type: .double, traits: ["smithy.api#default": 0]) +} diff --git a/Sources/Smithy/Schema/Schema.swift b/Sources/Smithy/Schema/Schema.swift new file mode 100644 index 000000000..14644b702 --- /dev/null +++ b/Sources/Smithy/Schema/Schema.swift @@ -0,0 +1,34 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +public class Schema { + public let id: String + public let type: ShapeType + public let traits: [String: Node] + public let members: [Schema] + public let memberName: String? + public let target: Schema? + public let index: Int + + public init( + id: String, + type: ShapeType, + traits: [String: Node] = [:], + members: [Schema] = [], + memberName: String? = nil, + target: Schema? = nil, + index: Int = -1 + ) { + self.id = id + self.type = type + self.traits = traits + self.members = members + self.memberName = memberName + self.target = target + self.index = index + } +} diff --git a/Sources/Smithy/Document/ShapeType.swift b/Sources/Smithy/Schema/ShapeType.swift similarity index 100% rename from Sources/Smithy/Document/ShapeType.swift rename to Sources/Smithy/Schema/ShapeType.swift diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt index 19f04bf0c..4123503ba 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt @@ -81,6 +81,7 @@ class DirectedSwiftCodegen( generateMessageMarshallable(ctx) generateMessageUnmarshallable(ctx) generateCodableConformanceForNestedTypes(ctx) + generateSchemas(ctx) initializeMiddleware(ctx) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt index 3b277f731..001aa70b9 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt @@ -18,6 +18,7 @@ import software.amazon.smithy.model.shapes.MemberShape import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.Shape import software.amazon.smithy.model.shapes.ShapeId +import software.amazon.smithy.model.shapes.ShapeType import software.amazon.smithy.model.shapes.StringShape import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.shapes.TimestampShape @@ -58,6 +59,7 @@ import software.amazon.smithy.swift.codegen.integration.middlewares.SignerMiddle import software.amazon.smithy.swift.codegen.integration.middlewares.providers.HttpHeaderProvider import software.amazon.smithy.swift.codegen.integration.middlewares.providers.HttpQueryItemProvider import software.amazon.smithy.swift.codegen.integration.middlewares.providers.HttpUrlPathProvider +import software.amazon.smithy.swift.codegen.integration.serde.schema.SchemaGenerator import software.amazon.smithy.swift.codegen.integration.serde.struct.StructDecodeGenerator import software.amazon.smithy.swift.codegen.integration.serde.struct.StructEncodeGenerator import software.amazon.smithy.swift.codegen.integration.serde.union.UnionDecodeGenerator @@ -72,6 +74,7 @@ import software.amazon.smithy.swift.codegen.model.isOutputEventStream import software.amazon.smithy.swift.codegen.supportsStreamingAndIsRPC import software.amazon.smithy.swift.codegen.swiftmodules.ClientRuntimeTypes import software.amazon.smithy.swift.codegen.utils.ModelFileUtils +import software.amazon.smithy.swift.codegen.utils.SchemaFileUtils import software.amazon.smithy.utils.OptionalUtils import java.util.Optional import java.util.logging.Logger @@ -139,6 +142,7 @@ abstract class HTTPBindingProtocolGenerator( override var serviceErrorProtocolSymbol: Symbol = ClientRuntimeTypes.Http.HttpError override fun generateSerializers(ctx: ProtocolGenerator.GenerationContext) { + if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition // render conformance to HttpRequestBinding for all input shapes val inputShapesWithHttpBindings: MutableSet = mutableSetOf() for (operation in getHttpBindingOperations(ctx)) { @@ -201,10 +205,40 @@ abstract class HTTPBindingProtocolGenerator( } } + private fun usesSchemaBasedSerialization(ctx: ProtocolGenerator.GenerationContext): Boolean = + // This fun is temporary; it will be eliminated when all services/protocols are moved to schema-based + ctx.service.allTraits.keys.any { it.name == "rpcv2Cbor" || it.name == "awsJson1_0" || it.name == "awsJson1_1" } + + override fun generateSchemas(ctx: ProtocolGenerator.GenerationContext) { + if (!usesSchemaBasedSerialization(ctx)) { return } // temporary condition + val nestedShapes = resolveShapesNeedingSchema(ctx) + .filter { it.type != ShapeType.MEMBER } // Member schemas are only rendered in-line + nestedShapes.forEach { renderSchemas(ctx, it) } + } + + private fun renderSchemas( + ctx: ProtocolGenerator.GenerationContext, + shape: Shape, + ) { + val symbol: Symbol = ctx.symbolProvider.toSymbol(shape) + val symbolName = symbol.name + val filename = SchemaFileUtils.filename(ctx.settings, "${shape.id.name}+Schema") + val encodeSymbol = + Symbol + .builder() + .definitionFile(filename) + .name(symbolName) + .build() + ctx.delegator.useShapeWriter(encodeSymbol) { writer -> + SchemaGenerator(ctx, writer).renderSchema(shape) + } + } + fun renderCodableExtension( ctx: ProtocolGenerator.GenerationContext, shape: Shape, ) { + if (!usesSchemaBasedSerialization(ctx)) { return } // temporary condition if (!shape.hasTrait() && !shape.hasTrait()) { return } @@ -250,11 +284,11 @@ abstract class HTTPBindingProtocolGenerator( } private fun resolveInputShapes(ctx: ProtocolGenerator.GenerationContext): Map> { - var shapesInfo: MutableMap> = mutableMapOf() + val shapesInfo: MutableMap> = mutableMapOf() val operations = getHttpBindingOperations(ctx) for (operation in operations) { val inputType = ctx.model.expectShape(operation.input.get()) - var metadata = + val metadata = mapOf( Pair(ShapeMetadata.OPERATION_SHAPE, operation), Pair(ShapeMetadata.SERVICE_VERSION, ctx.service.version), @@ -363,6 +397,73 @@ abstract class HTTPBindingProtocolGenerator( return resolved } + private fun resolveShapesNeedingSchema(ctx: ProtocolGenerator.GenerationContext): Set { + val topLevelInputMembers = getHttpBindingOperations(ctx).flatMap { + val inputShape = ctx.model.expectShape(it.input.get()) + inputShape.members() + } + .map { ctx.model.expectShape(it.target) } + .toSet() + + val topLevelOutputMembers = + getHttpBindingOperations(ctx) + .map { ctx.model.expectShape(it.output.get()) } + .toSet() + + val topLevelErrorMembers = + getHttpBindingOperations(ctx) + .flatMap { it.errors } + .map { ctx.model.expectShape(it) } + .toSet() + + val topLevelServiceErrorMembers = + ctx.service.errors + .map { ctx.model.expectShape(it) } + .toSet() + + val allTopLevelMembers = + topLevelInputMembers + .union(topLevelOutputMembers) + .union(topLevelErrorMembers) + .union(topLevelServiceErrorMembers) + + return walkNestedShapesRequiringSchema(ctx, allTopLevelMembers) + } + + private fun walkNestedShapesRequiringSchema( + ctx: ProtocolGenerator.GenerationContext, + shapes: Set, + ): Set { + val resolved = mutableSetOf() + val walker = Walker(ctx.model) + + // walk all the shapes in the set and find all other + // structs/unions (or collections thereof) in the graph from that shape + shapes.forEach { shape -> + walker + .iterateShapes(shape) { relationship -> + when (relationship.relationshipType) { + RelationshipType.MEMBER_TARGET, + RelationshipType.STRUCTURE_MEMBER, + RelationshipType.LIST_MEMBER, + RelationshipType.SET_MEMBER, + RelationshipType.MAP_KEY, + RelationshipType.MAP_VALUE, + RelationshipType.UNION_MEMBER, + -> true + else -> false + } + }.forEach { + // Don't generate schemas for Smithy built-in / "prelude" shapes. + // Those are included in runtime. + if (it.id.namespace != "smithy.api") { + resolved.add(it) + } + } + } + return resolved + } + // Checks for @requiresLength trait // Returns true if the operation: // - has a streaming member with @httpPayload trait diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/ProtocolGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/ProtocolGenerator.kt index fa558d524..bfcf3479b 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/ProtocolGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/ProtocolGenerator.kt @@ -122,6 +122,8 @@ interface ProtocolGenerator { */ fun generateCodableConformanceForNestedTypes(ctx: GenerationContext) + fun generateSchemas(ctx: GenerationContext) + /** * * Generate unit tests for the protocol diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt new file mode 100644 index 000000000..0f1b98533 --- /dev/null +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt @@ -0,0 +1,76 @@ +package software.amazon.smithy.swift.codegen.integration.serde.schema + +import software.amazon.smithy.model.shapes.MemberShape +import software.amazon.smithy.model.shapes.Shape +import software.amazon.smithy.swift.codegen.SwiftWriter +import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator +import software.amazon.smithy.swift.codegen.swiftmodules.SmithyTypes +import kotlin.jvm.optionals.getOrNull + +class SchemaGenerator( + val ctx: ProtocolGenerator.GenerationContext, + val writer: SwiftWriter, +) { + fun renderSchema(shape: Shape) { + writer.openBlock( + "var \$L: \$N {", + "}", + shape.schemaVar(writer), + SmithyTypes.Schema, + ) { + renderSchemaStruct(shape) + writer.unwrite(",\n") + writer.write("") + } + } + + private fun renderSchemaStruct(shape: Shape, index: Int? = null) { + writer.openBlock(".init(", "),") { + writer.write("id: \$S,", shape.id.toString()) + writer.write("type: .\$L,", shape.type) + val relevantTraits = shape.allTraits.filter { permittedTraitIDs.contains(it.key.toString()) } + if (relevantTraits.isNotEmpty()) { + writer.openBlock("traits: [", "],") { + relevantTraits.forEach { trait -> + writer.write( + "\$S: \$L,", + trait.key.toString(), + trait.value.toNode().toSwiftNode(writer), + ) + } + writer.unwrite(",\n") + writer.write("") + } + } + if (shape.members().isNotEmpty()) { + writer.openBlock("members: [", "],") { + shape.members().withIndex().forEach { renderSchemaStruct(it.value, it.index) } + writer.unwrite(",\n") + writer.write("") + } + } + shape.id.member + .getOrNull() + ?.let { writer.write("memberName: \$S,", it) } + targetShape(shape)?.let { writer.write("target: \$L,", it.schemaVar(writer)) } + index?.let { writer.write("index: \$L,", it) } + writer.unwrite(",\n") + writer.write("") + } + } + + private fun targetShape(shape: Shape): Shape? = memberShape(shape)?.let { ctx.model.expectShape(it.target) } + + private fun memberShape(shape: Shape): MemberShape? = shape.asMemberShape().getOrNull() +} + +private val permittedTraitIDs: Set = + setOf( + "smithy.api#sparse", + "smithy.api#enumValue", + "smithy.api#jsonName", + "smithy.api#required", + "smithy.api#default", + "smithy.api#timestampFormat", + "smithy.api#httpPayload", + ) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt new file mode 100644 index 000000000..104f5a0f5 --- /dev/null +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt @@ -0,0 +1,45 @@ +package software.amazon.smithy.swift.codegen.integration.serde.schema + +import software.amazon.smithy.model.shapes.Shape +import software.amazon.smithy.model.shapes.ShapeId +import software.amazon.smithy.swift.codegen.SwiftWriter +import software.amazon.smithy.swift.codegen.swiftmodules.SmithyTypes +import kotlin.jvm.optionals.getOrNull + +fun Shape.schemaVar(writer: SwiftWriter): String = + if (this.id.namespace == "smithy.api") { + this.id.preludeSchemaVarName(writer) + } else { + this.id.schemaVarName() + } + +private fun ShapeId.preludeSchemaVarName(writer: SwiftWriter): String = + when (this.name) { + "Unit" -> writer.format("\$N", SmithyTypes.unitSchema) + "String" -> writer.format("\$N", SmithyTypes.stringSchema) + "Blob" -> writer.format("\$N", SmithyTypes.blobSchema) + "Integer" -> writer.format("\$N", SmithyTypes.integerSchema) + "Timestamp" -> writer.format("\$N", SmithyTypes.timestampSchema) + "Boolean" -> writer.format("\$N", SmithyTypes.booleanSchema) + "Float" -> writer.format("\$N", SmithyTypes.floatSchema) + "Double" -> writer.format("\$N", SmithyTypes.doubleSchema) + "Long" -> writer.format("\$N", SmithyTypes.longSchema) + "Short" -> writer.format("\$N", SmithyTypes.shortSchema) + "Byte" -> writer.format("\$N", SmithyTypes.byteSchema) + "PrimitiveInteger" -> writer.format("\$N", SmithyTypes.primitiveIntegerSchema) + "PrimitiveBoolean" -> writer.format("\$N", SmithyTypes.primitiveBooleanSchema) + "PrimitiveFloat" -> writer.format("\$N", SmithyTypes.primitiveFloatSchema) + "PrimitiveDouble" -> writer.format("\$N", SmithyTypes.primitiveDoubleSchema) + "PrimitiveLong" -> writer.format("\$N", SmithyTypes.primitiveLongSchema) + "PrimitiveShort" -> writer.format("\$N", SmithyTypes.primitiveShortSchema) + "PrimitiveByte" -> writer.format("\$N", SmithyTypes.primitiveByteSchema) + "Document" -> writer.format("\$N", SmithyTypes.documentSchema) + else -> throw Exception("Unhandled prelude type converted to schemaVar: ${this.name}") + } + +private fun ShapeId.schemaVarName(): String { + assert(this.member.getOrNull() == null) + val namespacePortion = this.namespace.replace(".", "_") + val namePortion = this.name + return "schema__${namespacePortion}__${namePortion}" +} diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SwiftNodeUtils.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SwiftNodeUtils.kt new file mode 100644 index 000000000..b76c3624d --- /dev/null +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SwiftNodeUtils.kt @@ -0,0 +1,44 @@ +package software.amazon.smithy.swift.codegen.integration.serde.schema + +import software.amazon.smithy.model.node.ArrayNode +import software.amazon.smithy.model.node.BooleanNode +import software.amazon.smithy.model.node.Node +import software.amazon.smithy.model.node.NullNode +import software.amazon.smithy.model.node.NumberNode +import software.amazon.smithy.model.node.ObjectNode +import software.amazon.smithy.model.node.StringNode +import software.amazon.smithy.swift.codegen.SwiftWriter + +fun Node.toSwiftNode(writer: SwiftWriter): String = + when (this) { + is ObjectNode -> { + if (members.isEmpty()) { + writer.format("[:]") + } else { + val contents = + members.map { + writer.format("\$S:\$L", it.key, it.value.toSwiftNode(writer)) + } + writer.format("[\$L]", contents.joinToString(",")) + } + } + is ArrayNode -> { + val contents = elements.map { it.toSwiftNode(writer) } + writer.format("[\$L]", contents.joinToString(",")) + } + is StringNode -> { + writer.format("\$S", value) + } + is NumberNode -> { + writer.format("\$L", value) + } + is BooleanNode -> { + writer.format("\$L", value) + } + is NullNode -> { + writer.format("nil") + } + else -> { + throw Exception("Unknown node type") + } + } diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyReadWriteTypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyReadWriteTypes.kt index 070e26034..d383db5a1 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyReadWriteTypes.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyReadWriteTypes.kt @@ -27,6 +27,11 @@ object SmithyReadWriteTypes { val WritingClosures = runtimeSymbol("WritingClosures", SwiftDeclaration.ENUM) val ReadingClosureBox = runtimeSymbol("ReadingClosureBox", SwiftDeclaration.STRUCT) val WritingClosureBox = runtimeSymbol("WritingClosureBox", SwiftDeclaration.STRUCT) + val ShapeSerializer = runtimeSymbol("ShapeSerializer", SwiftDeclaration.PROTOCOL) + val ShapeDeserializer = runtimeSymbol("ShapeDeserializer", SwiftDeclaration.PROTOCOL) + val SerializableStruct = runtimeSymbol("SerializableStruct", SwiftDeclaration.PROTOCOL) + val DeserializableStruct = runtimeSymbol("DeserializableStruct", SwiftDeclaration.PROTOCOL) + val Unit = runtimeSymbol("Unit", SwiftDeclaration.STRUCT) } private fun runtimeSymbol( diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyTypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyTypes.kt index 4e8bd7caf..d9641d472 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyTypes.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyTypes.kt @@ -21,16 +21,38 @@ object SmithyTypes { val LogAgent = runtimeSymbol("LogAgent", SwiftDeclaration.PROTOCOL) val RequestMessageSerializer = runtimeSymbol("RequestMessageSerializer", SwiftDeclaration.PROTOCOL) val URIQueryItem = runtimeSymbol("URIQueryItem", SwiftDeclaration.STRUCT) + val Schema = runtimeSymbol("Schema", SwiftDeclaration.CLASS) + val unitSchema = runtimeSymbol("unitSchema", SwiftDeclaration.VAR) + val stringSchema = runtimeSymbol("stringSchema", SwiftDeclaration.VAR) + val blobSchema = runtimeSymbol("blobSchema", SwiftDeclaration.VAR) + val integerSchema = runtimeSymbol("integerSchema", SwiftDeclaration.VAR) + val timestampSchema = runtimeSymbol("timestampSchema", SwiftDeclaration.VAR) + val booleanSchema = runtimeSymbol("booleanSchema", SwiftDeclaration.VAR) + val floatSchema = runtimeSymbol("floatSchema", SwiftDeclaration.VAR) + val doubleSchema = runtimeSymbol("doubleSchema", SwiftDeclaration.VAR) + val longSchema = runtimeSymbol("longSchema", SwiftDeclaration.VAR) + val shortSchema = runtimeSymbol("shortSchema", SwiftDeclaration.VAR) + val byteSchema = runtimeSymbol("byteSchema", SwiftDeclaration.VAR) + val primitiveBooleanSchema = runtimeSymbol("primitiveBooleanSchema", SwiftDeclaration.VAR) + val primitiveFloatSchema = runtimeSymbol("primitiveFloatSchema", SwiftDeclaration.VAR) + val primitiveDoubleSchema = runtimeSymbol("primitiveDoubleSchema", SwiftDeclaration.VAR) + val primitiveLongSchema = runtimeSymbol("primitiveLongSchema", SwiftDeclaration.VAR) + val primitiveIntegerSchema = runtimeSymbol("primitiveIntegerSchema", SwiftDeclaration.VAR) + val primitiveShortSchema = runtimeSymbol("primitiveShortSchema", SwiftDeclaration.VAR) + val primitiveByteSchema = runtimeSymbol("primitiveByteSchema", SwiftDeclaration.VAR) + val documentSchema = runtimeSymbol("documentSchema", SwiftDeclaration.VAR) } private fun runtimeSymbol( name: String, - declaration: SwiftDeclaration? = null, + declaration: SwiftDeclaration?, + additionalImports: List = emptyList(), + spiName: List = emptyList(), ): Symbol = SwiftSymbol.make( name, declaration, - SwiftDependency.SMITHY, - emptyList(), - emptyList(), + SwiftDependency.SMITHY.takeIf { additionalImports.isEmpty() }, + additionalImports, + spiName, ) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SwiftTypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SwiftTypes.kt index 79dc669b1..24d437fe4 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SwiftTypes.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SwiftTypes.kt @@ -10,6 +10,7 @@ import software.amazon.smithy.swift.codegen.SwiftDeclaration import software.amazon.smithy.swift.codegen.SwiftDependency object SwiftTypes { + val Void = builtInSymbol("Void", SwiftDeclaration.STRUCT) val StringList = SwiftSymbol.make( "[String]", diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/utils/SchemaFileUtils.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/utils/SchemaFileUtils.kt new file mode 100644 index 000000000..240b99803 --- /dev/null +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/utils/SchemaFileUtils.kt @@ -0,0 +1,17 @@ +package software.amazon.smithy.swift.codegen.utils + +import software.amazon.smithy.swift.codegen.SwiftSettings + +class SchemaFileUtils { + companion object { + fun filename( + settings: SwiftSettings, + filename: String, + ): String = + if (settings.mergeModels) { + "Sources/${settings.moduleName}/Schemas.swift" + } else { + "Sources/${settings.moduleName}/schemas/$filename.swift" + } + } +} From ca5b3314f0ae8eaddca9574f3d1f000bfb3c0f2a Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Wed, 5 Nov 2025 09:21:51 -0600 Subject: [PATCH 2/9] add ShapeID, doc comments --- Package.swift | 4 + Sources/Smithy/Schema/Node.swift | 2 +- Sources/Smithy/Schema/Prelude.swift | 117 +++++++++--------- Sources/Smithy/Schema/Schema.swift | 54 ++++++-- Sources/Smithy/Schema/ShapeID.swift | 42 +++++++ Sources/Smithy/Schema/ShapeType.swift | 3 +- Tests/SmithyTests/ShapeIDTests.swift | 22 ++++ .../HTTPBindingProtocolGenerator.kt | 2 + .../serde/schema/SchemaGenerator.kt | 50 ++++---- .../serde/schema/SchemaShapeUtils.kt | 44 +++---- .../integration/serde/schema/SchemaTraits.kt | 12 ++ .../swift/codegen/swiftmodules/SmithyTypes.kt | 20 +-- 12 files changed, 240 insertions(+), 132 deletions(-) create mode 100644 Sources/Smithy/Schema/ShapeID.swift create mode 100644 Tests/SmithyTests/ShapeIDTests.swift create mode 100644 smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaTraits.kt diff --git a/Package.swift b/Package.swift index a781bbcb8..c8b62c889 100644 --- a/Package.swift +++ b/Package.swift @@ -268,6 +268,10 @@ let package = Package( ], resources: [ .process("Resources") ] ), + .testTarget( + name: "SmithyTests", + dependencies: ["Smithy"] + ), .testTarget( name: "SmithyCBORTests", dependencies: ["SmithyCBOR", "ClientRuntime", "SmithyTestUtil"] diff --git a/Sources/Smithy/Schema/Node.swift b/Sources/Smithy/Schema/Node.swift index 55f2c8618..ce6c2d64e 100644 --- a/Sources/Smithy/Schema/Node.swift +++ b/Sources/Smithy/Schema/Node.swift @@ -8,7 +8,7 @@ /// Contains the value of a Smithy Node. /// /// Smithy node data is basically the same as the data that can be stored in JSON. -/// The root of a Smithy node may be of any case, i.e. unlike JSON, the root element is not limited to object or list. +/// The root of a Smithy node may be of any type, i.e. unlike JSON, the root element is not limited to object or list. /// /// See the definition of node value in the Smithy spec: https://smithy.io/2.0/spec/model.html#node-values public enum Node: Sendable { diff --git a/Sources/Smithy/Schema/Prelude.swift b/Sources/Smithy/Schema/Prelude.swift index 79775e127..4658ccfc2 100644 --- a/Sources/Smithy/Schema/Prelude.swift +++ b/Sources/Smithy/Schema/Prelude.swift @@ -8,78 +8,83 @@ // Below are schemas for all model shapes defined in the Smithy 2.0 prelude. // Schemas for custom Smithy types may use these schemas in their definitions. -public var unitSchema: Schema { - Schema(id: "smithy.api#Unit", type: .structure) -} +public enum Prelude { -public var booleanSchema: Schema { - Schema(id: "smithy.api#Boolean", type: .boolean) -} + public static var unitSchema: Schema { + Schema(id: .init("smithy.api", "Unit"), type: .structure) + } -public var stringSchema: Schema { - Schema(id: "smithy.api#String", type: .string) -} + public static var booleanSchema: Schema { + Schema(id: .init("smithy.api", "Boolean"), type: .boolean) + } -public var integerSchema: Schema { - Schema(id: "smithy.api#Integer", type: .integer) -} + public static var stringSchema: Schema { + Schema(id: .init("smithy.api", "String"), type: .string) + } -public var blobSchema: Schema { - Schema(id: "smithy.api#Blob", type: .blob) -} + public static var integerSchema: Schema { + Schema(id: .init("smithy.api", "Integer"), type: .integer) + } -public var timestampSchema: Schema { - Schema(id: "smithy.api#Timestamp", type: .timestamp) -} + public static var blobSchema: Schema { + Schema(id: .init("smithy.api", "Blob"), type: .blob) + } -public var byteSchema: Schema { - Schema(id: "smithy.api#Byte", type: .byte) -} + public static var timestampSchema: Schema { + Schema(id: .init("smithy.api", "Timestamp"), type: .timestamp) + } -public var shortSchema: Schema { - Schema(id: "smithy.api#Short", type: .short) -} + public static var byteSchema: Schema { + Schema(id: .init("smithy.api", "Byte"), type: .byte) + } -public var longSchema: Schema { - Schema(id: "smithy.api#Long", type: .long) -} + public static var shortSchema: Schema { + Schema(id: .init("smithy.api", "Short"), type: .short) + } -public var floatSchema: Schema { - Schema(id: "smithy.api#Float", type: .float) -} + public static var longSchema: Schema { + Schema(id: .init("smithy.api", "Long"), type: .long) + } -public var doubleSchema: Schema { - Schema(id: "smithy.api#Double", type: .double) -} + public static var floatSchema: Schema { + Schema(id: .init("smithy.api", "Float"), type: .float) + } -public var documentSchema: Schema { - Schema(id: "smithy.api#PrimitiveDocument", type: .document) -} + public static var doubleSchema: Schema { + Schema(id: .init("smithy.api", "Double"), type: .double) + } -public var primitiveBooleanSchema: Schema { - Schema(id: "smithy.api#PrimitiveBoolean", type: .boolean, traits: ["smithy.api#default": false]) -} + public static var documentSchema: Schema { + Schema(id: .init("smithy.api", "PrimitiveDocument"), type: .document) + } -public var primitiveIntegerSchema: Schema { - Schema(id: "smithy.api#PrimitiveInteger", type: .integer, traits: ["smithy.api#default": 0]) -} + public static var primitiveBooleanSchema: Schema { + Schema(id: .init("smithy.api", "PrimitiveBoolean"), type: .boolean, traits: [defaultTraitID: false]) + } -public var primitiveByteSchema: Schema { - Schema(id: "smithy.api#PrimitiveByte", type: .byte, traits: ["smithy.api#default": 0]) -} + public static var primitiveIntegerSchema: Schema { + Schema(id: .init("smithy.api", "PrimitiveInteger"), type: .integer, traits: [defaultTraitID: 0]) + } -public var primitiveShortSchema: Schema { - Schema(id: "smithy.api#PrimitiveShort", type: .short, traits: ["smithy.api#default": 0]) -} + public static var primitiveByteSchema: Schema { + Schema(id: .init("smithy.api", "PrimitiveByte"), type: .byte, traits: [defaultTraitID: 0]) + } -public var primitiveLongSchema: Schema { - Schema(id: "smithy.api#PrimitiveLong", type: .long, traits: ["smithy.api#default": 0]) -} + public static var primitiveShortSchema: Schema { + Schema(id: .init("smithy.api", "PrimitiveShort"), type: .short, traits: [defaultTraitID: 0]) + } -public var primitiveFloatSchema: Schema { - Schema(id: "smithy.api#PrimitiveFloat", type: .float, traits: ["smithy.api#default": 0]) -} + public static var primitiveLongSchema: Schema { + Schema(id: .init("smithy.api", "PrimitiveLong"), type: .long, traits: [defaultTraitID: 0]) + } -public var primitiveDoubleSchema: Schema { - Schema(id: "smithy.api#PrimitiveDouble", type: .double, traits: ["smithy.api#default": 0]) + public static var primitiveFloatSchema: Schema { + Schema(id: .init("smithy.api", "PrimitiveFloat"), type: .float, traits: [defaultTraitID: 0]) + } + + public static var primitiveDoubleSchema: Schema { + Schema(id: .init("smithy.api", "PrimitiveDouble"), type: .double, traits: [defaultTraitID: 0]) + } } + +private let defaultTraitID = ShapeID("smithy.api", "default") diff --git a/Sources/Smithy/Schema/Schema.swift b/Sources/Smithy/Schema/Schema.swift index 14644b702..ff94fd859 100644 --- a/Sources/Smithy/Schema/Schema.swift +++ b/Sources/Smithy/Schema/Schema.swift @@ -5,21 +5,50 @@ // SPDX-License-Identifier: Apache-2.0 // +/// A structure which describes selected Smithy model information for a Smithy model shape. +/// +/// Typically, the Schema contains only modeled info & properties that are relevant to +/// serialization, transport bindings, and other functions performed by the SDK. public class Schema { - public let id: String + + /// The Smithy shape ID for the shape described by this schema. + public let id: ShapeID + + /// The type of the shape being described. public let type: ShapeType - public let traits: [String: Node] + + /// A dictionary of the described shape's trait shape IDs to Nodes with trait data. + /// + /// Not all traits for a shape will be represented in the schema; + /// typically the Schema contains only the traits relevant to the client-side SDK. + public let traits: [ShapeID: Node] + + /// The member schemas for this schema, if any. + /// + /// Typically only a schema of type Structure, Union, Enum, IntEnum, List or Map will have members. public let members: [Schema] - public let memberName: String? + + /// The target schema for this schema. Will only be used when this is a member schema. public let target: Schema? - public let index: Int + /// The index of this schema, if it represents a Smithy member. + /// + /// For a member schema, index will be set to its index in the members array. + /// For other types of schema, index will be `-1`. + /// + /// This index is intended for use as a performance enhancement when looking up member schemas + /// during deserialization. + public let index: Int + + /// Creates a new Schema using the passed parameters. + /// + /// No validation is performed on the parameters since calls to this initializer + /// are almost always code-generated from a previously validated Smithy model. public init( - id: String, + id: ShapeID, type: ShapeType, - traits: [String: Node] = [:], + traits: [ShapeID: Node] = [:], members: [Schema] = [], - memberName: String? = nil, target: Schema? = nil, index: Int = -1 ) { @@ -27,8 +56,17 @@ public class Schema { self.type = type self.traits = traits self.members = members - self.memberName = memberName self.target = target self.index = index } } + +public extension Schema { + + /// The member name for this schema, if any. + /// + /// Member name is computed from the schema's ID. + var memberName: String? { + id.member + } +} diff --git a/Sources/Smithy/Schema/ShapeID.swift b/Sources/Smithy/Schema/ShapeID.swift new file mode 100644 index 000000000..b78a4d3bb --- /dev/null +++ b/Sources/Smithy/Schema/ShapeID.swift @@ -0,0 +1,42 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +/// Represents a single Smithy shape ID. +/// +/// Shape ID is described in the Smithy 2.0 spec [here](https://smithy.io/2.0/spec/model.html#shape-id). +public struct ShapeID: Hashable { + public let namespace: String + public let name: String + public let member: String? + + /// Creates a Shape ID for a Smithy shape. + /// + /// This initializer does no validation of length or of allowed characters in the Shape ID; + /// that is to be ensured by the caller (typically calls to this initializer will be code-generated + /// from previously validated Smithy models.) + /// - Parameters: + /// - namespace: The namespace for this shape, i.e. `smithy.api`. + /// - name: The name for this shape, i.e. `Integer`. + /// - member: The optional member name for this shape. + public init(_ namespace: String, _ name: String, _ member: String? = nil) { + self.namespace = namespace + self.name = name + self.member = member + } +} + +extension ShapeID: CustomStringConvertible { + + /// Returns the absolute Shape ID in a single, printable string. + public var description: String { + if let member = self.member { + return "\(namespace)#\(name)$\(member)" + } else { + return "\(namespace)#\(name)" + } + } +} diff --git a/Sources/Smithy/Schema/ShapeType.swift b/Sources/Smithy/Schema/ShapeType.swift index 5b3de70a1..310a24fe8 100644 --- a/Sources/Smithy/Schema/ShapeType.swift +++ b/Sources/Smithy/Schema/ShapeType.swift @@ -5,8 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 // -/// Reproduces the cases in Smithy `ShapeType`. -/// https://github.com/smithy-lang/smithy/blob/main/smithy-model/src/main/java/software/amazon/smithy/model/shapes/ShapeType.java +/// Reproduces the cases in Smithy [ShapeType](https://github.com/smithy-lang/smithy/blob/main/smithy-model/src/main/java/software/amazon/smithy/model/shapes/ShapeType.java). public enum ShapeType { case blob case boolean diff --git a/Tests/SmithyTests/ShapeIDTests.swift b/Tests/SmithyTests/ShapeIDTests.swift new file mode 100644 index 000000000..d4b28de16 --- /dev/null +++ b/Tests/SmithyTests/ShapeIDTests.swift @@ -0,0 +1,22 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import XCTest +import Smithy + +class ShapeIDTests: XCTestCase { + + func test_description_noMember() { + let subject = ShapeID("smithy.test", "TestShape") + XCTAssertEqual(subject.description, "smithy.test#TestShape") + } + + func test_description_withMember() { + let subject = ShapeID("smithy.test", "TestShape", "TestMember") + XCTAssertEqual(subject.description, "smithy.test#TestShape$TestMember") + } +} diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt index 001aa70b9..278497c00 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt @@ -191,12 +191,14 @@ abstract class HTTPBindingProtocolGenerator( } override fun generateDeserializers(ctx: ProtocolGenerator.GenerationContext) { + if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition val httpOperations = getHttpBindingOperations(ctx) val httpBindingResolver = getProtocolHttpBindingResolver(ctx, defaultContentType) httpResponseGenerator.render(ctx, httpOperations, httpBindingResolver) } override fun generateCodableConformanceForNestedTypes(ctx: ProtocolGenerator.GenerationContext) { + if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition val nestedShapes = resolveShapesNeedingCodableConformance(ctx) .filter { !it.isEventStreaming } diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt index 0f1b98533..234f8f59f 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt @@ -2,6 +2,7 @@ package software.amazon.smithy.swift.codegen.integration.serde.schema import software.amazon.smithy.model.shapes.MemberShape import software.amazon.smithy.model.shapes.Shape +import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.swift.codegen.SwiftWriter import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.swiftmodules.SmithyTypes @@ -26,51 +27,50 @@ class SchemaGenerator( private fun renderSchemaStruct(shape: Shape, index: Int? = null) { writer.openBlock(".init(", "),") { - writer.write("id: \$S,", shape.id.toString()) + writer.write( + "id: \$L,", + shapeID(shape.id), + ) writer.write("type: .\$L,", shape.type) val relevantTraits = shape.allTraits.filter { permittedTraitIDs.contains(it.key.toString()) } if (relevantTraits.isNotEmpty()) { writer.openBlock("traits: [", "],") { relevantTraits.forEach { trait -> writer.write( - "\$S: \$L,", - trait.key.toString(), + "\$L: \$L,", + shapeID(trait.key), trait.value.toNode().toSwiftNode(writer), ) } - writer.unwrite(",\n") - writer.write("") } } if (shape.members().isNotEmpty()) { writer.openBlock("members: [", "],") { shape.members().withIndex().forEach { renderSchemaStruct(it.value, it.index) } - writer.unwrite(",\n") - writer.write("") } } - shape.id.member - .getOrNull() - ?.let { writer.write("memberName: \$S,", it) } - targetShape(shape)?.let { writer.write("target: \$L,", it.schemaVar(writer)) } - index?.let { writer.write("index: \$L,", it) } + targetShape(shape)?.let { + writer.write("target: \$L,", it.schemaVar(writer)) + } + index?.let { + writer.write("index: \$L,", it) + } writer.unwrite(",\n") writer.write("") } } - private fun targetShape(shape: Shape): Shape? = memberShape(shape)?.let { ctx.model.expectShape(it.target) } + private fun shapeID(id: ShapeId): String = + writer.format( + ".init(\$S, \$S\$L)", + id.namespace, + id.name, + id.member.getOrNull()?.let { writer.format(", \$S", it) } ?: "", + ) - private fun memberShape(shape: Shape): MemberShape? = shape.asMemberShape().getOrNull() -} + private fun targetShape(shape: Shape): Shape? = + memberShape(shape)?.let { ctx.model.expectShape(it.target) } -private val permittedTraitIDs: Set = - setOf( - "smithy.api#sparse", - "smithy.api#enumValue", - "smithy.api#jsonName", - "smithy.api#required", - "smithy.api#default", - "smithy.api#timestampFormat", - "smithy.api#httpPayload", - ) + private fun memberShape(shape: Shape): MemberShape? = + shape.asMemberShape().getOrNull() +} diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt index 104f5a0f5..ac2f7b2bb 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt @@ -13,29 +13,31 @@ fun Shape.schemaVar(writer: SwiftWriter): String = this.id.schemaVarName() } -private fun ShapeId.preludeSchemaVarName(writer: SwiftWriter): String = - when (this.name) { - "Unit" -> writer.format("\$N", SmithyTypes.unitSchema) - "String" -> writer.format("\$N", SmithyTypes.stringSchema) - "Blob" -> writer.format("\$N", SmithyTypes.blobSchema) - "Integer" -> writer.format("\$N", SmithyTypes.integerSchema) - "Timestamp" -> writer.format("\$N", SmithyTypes.timestampSchema) - "Boolean" -> writer.format("\$N", SmithyTypes.booleanSchema) - "Float" -> writer.format("\$N", SmithyTypes.floatSchema) - "Double" -> writer.format("\$N", SmithyTypes.doubleSchema) - "Long" -> writer.format("\$N", SmithyTypes.longSchema) - "Short" -> writer.format("\$N", SmithyTypes.shortSchema) - "Byte" -> writer.format("\$N", SmithyTypes.byteSchema) - "PrimitiveInteger" -> writer.format("\$N", SmithyTypes.primitiveIntegerSchema) - "PrimitiveBoolean" -> writer.format("\$N", SmithyTypes.primitiveBooleanSchema) - "PrimitiveFloat" -> writer.format("\$N", SmithyTypes.primitiveFloatSchema) - "PrimitiveDouble" -> writer.format("\$N", SmithyTypes.primitiveDoubleSchema) - "PrimitiveLong" -> writer.format("\$N", SmithyTypes.primitiveLongSchema) - "PrimitiveShort" -> writer.format("\$N", SmithyTypes.primitiveShortSchema) - "PrimitiveByte" -> writer.format("\$N", SmithyTypes.primitiveByteSchema) - "Document" -> writer.format("\$N", SmithyTypes.documentSchema) +private fun ShapeId.preludeSchemaVarName(writer: SwiftWriter): String { + val propertyName = when (this.name) { + "Unit" -> "unitSchema" + "String" -> "stringSchema" + "Blob" -> "blobSchema" + "Integer" -> "integerSchema" + "Timestamp" -> "timestampSchema" + "Boolean" -> "booleanSchema" + "Float" -> "floatSchema" + "Double" -> "doubleSchema" + "Long" -> "longSchema" + "Short" -> "shortSchema" + "Byte" -> "byteSchema" + "PrimitiveInteger" -> "primitiveIntegerSchema" + "PrimitiveBoolean" -> "primitiveBooleanSchema" + "PrimitiveFloat" -> "primitiveFloatSchema" + "PrimitiveDouble" -> "primitiveDoubleSchema" + "PrimitiveLong" -> "primitiveLongSchema" + "PrimitiveShort" -> "primitiveShortSchema" + "PrimitiveByte" -> "primitiveByteSchema" + "Document" -> "documentSchema" else -> throw Exception("Unhandled prelude type converted to schemaVar: ${this.name}") } + return writer.format("\$N.\$L", SmithyTypes.Prelude, propertyName) +} private fun ShapeId.schemaVarName(): String { assert(this.member.getOrNull() == null) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaTraits.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaTraits.kt new file mode 100644 index 000000000..91a446af6 --- /dev/null +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaTraits.kt @@ -0,0 +1,12 @@ +package software.amazon.smithy.swift.codegen.integration.serde.schema + +val permittedTraitIDs: Set = + setOf( + "smithy.api#sparse", + "smithy.api#enumValue", + "smithy.api#jsonName", + "smithy.api#required", + "smithy.api#default", + "smithy.api#timestampFormat", + "smithy.api#httpPayload", + ) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyTypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyTypes.kt index d9641d472..560632fdb 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyTypes.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyTypes.kt @@ -22,25 +22,7 @@ object SmithyTypes { val RequestMessageSerializer = runtimeSymbol("RequestMessageSerializer", SwiftDeclaration.PROTOCOL) val URIQueryItem = runtimeSymbol("URIQueryItem", SwiftDeclaration.STRUCT) val Schema = runtimeSymbol("Schema", SwiftDeclaration.CLASS) - val unitSchema = runtimeSymbol("unitSchema", SwiftDeclaration.VAR) - val stringSchema = runtimeSymbol("stringSchema", SwiftDeclaration.VAR) - val blobSchema = runtimeSymbol("blobSchema", SwiftDeclaration.VAR) - val integerSchema = runtimeSymbol("integerSchema", SwiftDeclaration.VAR) - val timestampSchema = runtimeSymbol("timestampSchema", SwiftDeclaration.VAR) - val booleanSchema = runtimeSymbol("booleanSchema", SwiftDeclaration.VAR) - val floatSchema = runtimeSymbol("floatSchema", SwiftDeclaration.VAR) - val doubleSchema = runtimeSymbol("doubleSchema", SwiftDeclaration.VAR) - val longSchema = runtimeSymbol("longSchema", SwiftDeclaration.VAR) - val shortSchema = runtimeSymbol("shortSchema", SwiftDeclaration.VAR) - val byteSchema = runtimeSymbol("byteSchema", SwiftDeclaration.VAR) - val primitiveBooleanSchema = runtimeSymbol("primitiveBooleanSchema", SwiftDeclaration.VAR) - val primitiveFloatSchema = runtimeSymbol("primitiveFloatSchema", SwiftDeclaration.VAR) - val primitiveDoubleSchema = runtimeSymbol("primitiveDoubleSchema", SwiftDeclaration.VAR) - val primitiveLongSchema = runtimeSymbol("primitiveLongSchema", SwiftDeclaration.VAR) - val primitiveIntegerSchema = runtimeSymbol("primitiveIntegerSchema", SwiftDeclaration.VAR) - val primitiveShortSchema = runtimeSymbol("primitiveShortSchema", SwiftDeclaration.VAR) - val primitiveByteSchema = runtimeSymbol("primitiveByteSchema", SwiftDeclaration.VAR) - val documentSchema = runtimeSymbol("documentSchema", SwiftDeclaration.VAR) + val Prelude = runtimeSymbol("Prelude", SwiftDeclaration.ENUM) } private fun runtimeSymbol( From 212120efe53751192510aa81569690069b7e839c Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Wed, 5 Nov 2025 10:17:42 -0600 Subject: [PATCH 3/9] Re-enable serde code --- .../amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt | 2 -- .../codegen/integration/HTTPBindingProtocolGenerator.kt | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt index 4123503ba..94a56b8bc 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DirectedSwiftCodegen.kt @@ -72,7 +72,6 @@ class DirectedSwiftCodegen( LOGGER.info("Generating Swift client for service ${directive.settings().service}") - var shouldGenerateTestTarget = false context.protocolGenerator?.apply { val ctx = ProtocolGenerator.GenerationContext(settings, model, service, symbolProvider, integrations, this.protocol, writers) LOGGER.info("[${service.id}] Generating serde for protocol ${this.protocol}") @@ -87,7 +86,6 @@ class DirectedSwiftCodegen( LOGGER.info("[${service.id}] Generating unit tests for protocol ${this.protocol}") val numProtocolUnitTestsGenerated = generateProtocolUnitTests(ctx) - shouldGenerateTestTarget = (numProtocolUnitTestsGenerated > 0) LOGGER.info("[${service.id}] Generated $numProtocolUnitTestsGenerated tests for protocol ${this.protocol}") diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt index 278497c00..edce23ef9 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt @@ -142,7 +142,7 @@ abstract class HTTPBindingProtocolGenerator( override var serviceErrorProtocolSymbol: Symbol = ClientRuntimeTypes.Http.HttpError override fun generateSerializers(ctx: ProtocolGenerator.GenerationContext) { - if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition +// if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition // render conformance to HttpRequestBinding for all input shapes val inputShapesWithHttpBindings: MutableSet = mutableSetOf() for (operation in getHttpBindingOperations(ctx)) { @@ -191,14 +191,14 @@ abstract class HTTPBindingProtocolGenerator( } override fun generateDeserializers(ctx: ProtocolGenerator.GenerationContext) { - if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition +// if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition val httpOperations = getHttpBindingOperations(ctx) val httpBindingResolver = getProtocolHttpBindingResolver(ctx, defaultContentType) httpResponseGenerator.render(ctx, httpOperations, httpBindingResolver) } override fun generateCodableConformanceForNestedTypes(ctx: ProtocolGenerator.GenerationContext) { - if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition +// if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition val nestedShapes = resolveShapesNeedingCodableConformance(ctx) .filter { !it.isEventStreaming } @@ -240,7 +240,7 @@ abstract class HTTPBindingProtocolGenerator( ctx: ProtocolGenerator.GenerationContext, shape: Shape, ) { - if (!usesSchemaBasedSerialization(ctx)) { return } // temporary condition +// if (!usesSchemaBasedSerialization(ctx)) { return } // temporary condition if (!shape.hasTrait() && !shape.hasTrait()) { return } From fcdf1bf6822c445ac7b15e2ee7c4bc29627c7ba1 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Wed, 5 Nov 2025 11:12:14 -0600 Subject: [PATCH 4/9] Cleanup --- Sources/Smithy/Schema/Schema.swift | 12 ++--- Sources/Smithy/Schema/ShapeID.swift | 6 +-- Sources/Smithy/Schema/ShapeType.swift | 2 +- .../HTTPBindingProtocolGenerator.kt | 31 ++++++------ .../serde/schema/SchemaGenerator.kt | 11 +++-- .../serde/schema/SchemaShapeUtils.kt | 47 ++++++++++--------- .../swiftmodules/SmithyReadWriteTypes.kt | 5 -- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/Sources/Smithy/Schema/Schema.swift b/Sources/Smithy/Schema/Schema.swift index ff94fd859..f8cac05fb 100644 --- a/Sources/Smithy/Schema/Schema.swift +++ b/Sources/Smithy/Schema/Schema.swift @@ -5,24 +5,24 @@ // SPDX-License-Identifier: Apache-2.0 // -/// A structure which describes selected Smithy model information for a Smithy model shape. +/// A class which describes selected Smithy model information for a Smithy model shape. /// /// Typically, the Schema contains only modeled info & properties that are relevant to /// serialization, transport bindings, and other functions performed by the SDK. -public class Schema { +public final class Schema: Sendable { /// The Smithy shape ID for the shape described by this schema. public let id: ShapeID - + /// The type of the shape being described. public let type: ShapeType - + /// A dictionary of the described shape's trait shape IDs to Nodes with trait data. /// /// Not all traits for a shape will be represented in the schema; /// typically the Schema contains only the traits relevant to the client-side SDK. public let traits: [ShapeID: Node] - + /// The member schemas for this schema, if any. /// /// Typically only a schema of type Structure, Union, Enum, IntEnum, List or Map will have members. @@ -39,7 +39,7 @@ public class Schema { /// This index is intended for use as a performance enhancement when looking up member schemas /// during deserialization. public let index: Int - + /// Creates a new Schema using the passed parameters. /// /// No validation is performed on the parameters since calls to this initializer diff --git a/Sources/Smithy/Schema/ShapeID.swift b/Sources/Smithy/Schema/ShapeID.swift index b78a4d3bb..647bbfeb8 100644 --- a/Sources/Smithy/Schema/ShapeID.swift +++ b/Sources/Smithy/Schema/ShapeID.swift @@ -8,11 +8,11 @@ /// Represents a single Smithy shape ID. /// /// Shape ID is described in the Smithy 2.0 spec [here](https://smithy.io/2.0/spec/model.html#shape-id). -public struct ShapeID: Hashable { +public struct ShapeID: Sendable, Hashable { public let namespace: String public let name: String public let member: String? - + /// Creates a Shape ID for a Smithy shape. /// /// This initializer does no validation of length or of allowed characters in the Shape ID; @@ -30,7 +30,7 @@ public struct ShapeID: Hashable { } extension ShapeID: CustomStringConvertible { - + /// Returns the absolute Shape ID in a single, printable string. public var description: String { if let member = self.member { diff --git a/Sources/Smithy/Schema/ShapeType.swift b/Sources/Smithy/Schema/ShapeType.swift index 310a24fe8..43a97cc5b 100644 --- a/Sources/Smithy/Schema/ShapeType.swift +++ b/Sources/Smithy/Schema/ShapeType.swift @@ -6,7 +6,7 @@ // /// Reproduces the cases in Smithy [ShapeType](https://github.com/smithy-lang/smithy/blob/main/smithy-model/src/main/java/software/amazon/smithy/model/shapes/ShapeType.java). -public enum ShapeType { +public enum ShapeType: Sendable { case blob case boolean case string diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt index edce23ef9..cfd98792a 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HTTPBindingProtocolGenerator.kt @@ -142,7 +142,7 @@ abstract class HTTPBindingProtocolGenerator( override var serviceErrorProtocolSymbol: Symbol = ClientRuntimeTypes.Http.HttpError override fun generateSerializers(ctx: ProtocolGenerator.GenerationContext) { -// if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition +// if (usesSchemaBasedSerialization(ctx)) return // temporary condition // render conformance to HttpRequestBinding for all input shapes val inputShapesWithHttpBindings: MutableSet = mutableSetOf() for (operation in getHttpBindingOperations(ctx)) { @@ -191,14 +191,14 @@ abstract class HTTPBindingProtocolGenerator( } override fun generateDeserializers(ctx: ProtocolGenerator.GenerationContext) { -// if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition +// if (usesSchemaBasedSerialization(ctx)) return // temporary condition val httpOperations = getHttpBindingOperations(ctx) val httpBindingResolver = getProtocolHttpBindingResolver(ctx, defaultContentType) httpResponseGenerator.render(ctx, httpOperations, httpBindingResolver) } override fun generateCodableConformanceForNestedTypes(ctx: ProtocolGenerator.GenerationContext) { -// if (usesSchemaBasedSerialization(ctx)) { return } // temporary condition +// if (usesSchemaBasedSerialization(ctx)) return // temporary condition val nestedShapes = resolveShapesNeedingCodableConformance(ctx) .filter { !it.isEventStreaming } @@ -209,12 +209,14 @@ abstract class HTTPBindingProtocolGenerator( private fun usesSchemaBasedSerialization(ctx: ProtocolGenerator.GenerationContext): Boolean = // This fun is temporary; it will be eliminated when all services/protocols are moved to schema-based - ctx.service.allTraits.keys.any { it.name == "rpcv2Cbor" || it.name == "awsJson1_0" || it.name == "awsJson1_1" } + ctx.service.allTraits.keys + .any { it.name == "rpcv2Cbor" } override fun generateSchemas(ctx: ProtocolGenerator.GenerationContext) { - if (!usesSchemaBasedSerialization(ctx)) { return } // temporary condition - val nestedShapes = resolveShapesNeedingSchema(ctx) - .filter { it.type != ShapeType.MEMBER } // Member schemas are only rendered in-line + if (!usesSchemaBasedSerialization(ctx)) return // temporary condition + val nestedShapes = + resolveShapesNeedingSchema(ctx) + .filter { it.type != ShapeType.MEMBER } // Member schemas are only rendered in-line nestedShapes.forEach { renderSchemas(ctx, it) } } @@ -240,7 +242,7 @@ abstract class HTTPBindingProtocolGenerator( ctx: ProtocolGenerator.GenerationContext, shape: Shape, ) { -// if (!usesSchemaBasedSerialization(ctx)) { return } // temporary condition +// if (!usesSchemaBasedSerialization(ctx)) return // temporary condition if (!shape.hasTrait() && !shape.hasTrait()) { return } @@ -400,12 +402,13 @@ abstract class HTTPBindingProtocolGenerator( } private fun resolveShapesNeedingSchema(ctx: ProtocolGenerator.GenerationContext): Set { - val topLevelInputMembers = getHttpBindingOperations(ctx).flatMap { - val inputShape = ctx.model.expectShape(it.input.get()) - inputShape.members() - } - .map { ctx.model.expectShape(it.target) } - .toSet() + val topLevelInputMembers = + getHttpBindingOperations(ctx) + .flatMap { + val inputShape = ctx.model.expectShape(it.input.get()) + inputShape.members() + }.map { ctx.model.expectShape(it.target) } + .toSet() val topLevelOutputMembers = getHttpBindingOperations(ctx) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt index 234f8f59f..dd666794b 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaGenerator.kt @@ -25,7 +25,10 @@ class SchemaGenerator( } } - private fun renderSchemaStruct(shape: Shape, index: Int? = null) { + private fun renderSchemaStruct( + shape: Shape, + index: Int? = null, + ) { writer.openBlock(".init(", "),") { writer.write( "id: \$L,", @@ -68,9 +71,7 @@ class SchemaGenerator( id.member.getOrNull()?.let { writer.format(", \$S", it) } ?: "", ) - private fun targetShape(shape: Shape): Shape? = - memberShape(shape)?.let { ctx.model.expectShape(it.target) } + private fun targetShape(shape: Shape): Shape? = memberShape(shape)?.let { ctx.model.expectShape(it.target) } - private fun memberShape(shape: Shape): MemberShape? = - shape.asMemberShape().getOrNull() + private fun memberShape(shape: Shape): MemberShape? = shape.asMemberShape().getOrNull() } diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt index ac2f7b2bb..74af64df7 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/schema/SchemaShapeUtils.kt @@ -14,28 +14,29 @@ fun Shape.schemaVar(writer: SwiftWriter): String = } private fun ShapeId.preludeSchemaVarName(writer: SwiftWriter): String { - val propertyName = when (this.name) { - "Unit" -> "unitSchema" - "String" -> "stringSchema" - "Blob" -> "blobSchema" - "Integer" -> "integerSchema" - "Timestamp" -> "timestampSchema" - "Boolean" -> "booleanSchema" - "Float" -> "floatSchema" - "Double" -> "doubleSchema" - "Long" -> "longSchema" - "Short" -> "shortSchema" - "Byte" -> "byteSchema" - "PrimitiveInteger" -> "primitiveIntegerSchema" - "PrimitiveBoolean" -> "primitiveBooleanSchema" - "PrimitiveFloat" -> "primitiveFloatSchema" - "PrimitiveDouble" -> "primitiveDoubleSchema" - "PrimitiveLong" -> "primitiveLongSchema" - "PrimitiveShort" -> "primitiveShortSchema" - "PrimitiveByte" -> "primitiveByteSchema" - "Document" -> "documentSchema" - else -> throw Exception("Unhandled prelude type converted to schemaVar: ${this.name}") - } + val propertyName = + when (this.name) { + "Unit" -> "unitSchema" + "String" -> "stringSchema" + "Blob" -> "blobSchema" + "Integer" -> "integerSchema" + "Timestamp" -> "timestampSchema" + "Boolean" -> "booleanSchema" + "Float" -> "floatSchema" + "Double" -> "doubleSchema" + "Long" -> "longSchema" + "Short" -> "shortSchema" + "Byte" -> "byteSchema" + "PrimitiveInteger" -> "primitiveIntegerSchema" + "PrimitiveBoolean" -> "primitiveBooleanSchema" + "PrimitiveFloat" -> "primitiveFloatSchema" + "PrimitiveDouble" -> "primitiveDoubleSchema" + "PrimitiveLong" -> "primitiveLongSchema" + "PrimitiveShort" -> "primitiveShortSchema" + "PrimitiveByte" -> "primitiveByteSchema" + "Document" -> "documentSchema" + else -> throw Exception("Unhandled prelude type converted to schemaVar: ${this.name}") + } return writer.format("\$N.\$L", SmithyTypes.Prelude, propertyName) } @@ -43,5 +44,5 @@ private fun ShapeId.schemaVarName(): String { assert(this.member.getOrNull() == null) val namespacePortion = this.namespace.replace(".", "_") val namePortion = this.name - return "schema__${namespacePortion}__${namePortion}" + return "schema__${namespacePortion}__$namePortion" } diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyReadWriteTypes.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyReadWriteTypes.kt index d383db5a1..070e26034 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyReadWriteTypes.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/swiftmodules/SmithyReadWriteTypes.kt @@ -27,11 +27,6 @@ object SmithyReadWriteTypes { val WritingClosures = runtimeSymbol("WritingClosures", SwiftDeclaration.ENUM) val ReadingClosureBox = runtimeSymbol("ReadingClosureBox", SwiftDeclaration.STRUCT) val WritingClosureBox = runtimeSymbol("WritingClosureBox", SwiftDeclaration.STRUCT) - val ShapeSerializer = runtimeSymbol("ShapeSerializer", SwiftDeclaration.PROTOCOL) - val ShapeDeserializer = runtimeSymbol("ShapeDeserializer", SwiftDeclaration.PROTOCOL) - val SerializableStruct = runtimeSymbol("SerializableStruct", SwiftDeclaration.PROTOCOL) - val DeserializableStruct = runtimeSymbol("DeserializableStruct", SwiftDeclaration.PROTOCOL) - val Unit = runtimeSymbol("Unit", SwiftDeclaration.STRUCT) } private fun runtimeSymbol( From 955e848b073189be10d6e1a89abef933e0cf7873 Mon Sep 17 00:00:00 2001 From: Chan <55515281+sichanyoo@users.noreply.github.com> Date: Thu, 6 Nov 2025 10:53:14 -0800 Subject: [PATCH 5/9] chore: Bump aws-crt-swift version to v0.54.1 (#990) Co-authored-by: Sichan Yoo --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index a781bbcb8..27d79ff29 100644 --- a/Package.swift +++ b/Package.swift @@ -56,7 +56,7 @@ let package = Package( ], dependencies: { var dependencies: [Package.Dependency] = [ - .package(url: "https://github.com/awslabs/aws-crt-swift.git", exact: "0.54.0"), + .package(url: "https://github.com/awslabs/aws-crt-swift.git", exact: "0.54.1"), .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), .package(url: "https://github.com/open-telemetry/opentelemetry-swift", from: "1.13.0"), ] From 58b8969b71eb06d309c51c3f4436c5c6c6f1cabe Mon Sep 17 00:00:00 2001 From: AWS SDK Swift Automation Date: Thu, 6 Nov 2025 19:41:57 +0000 Subject: [PATCH 6/9] chore: Updates version to 0.169.0 --- Package.version | 2 +- Package.version.next | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.version b/Package.version index 06cc9779a..306cba6c0 100644 --- a/Package.version +++ b/Package.version @@ -1 +1 @@ -0.168.0 \ No newline at end of file +0.169.0 \ No newline at end of file diff --git a/Package.version.next b/Package.version.next index 306cba6c0..1d80af247 100644 --- a/Package.version.next +++ b/Package.version.next @@ -1 +1 @@ -0.169.0 \ No newline at end of file +0.170.0 \ No newline at end of file From 5a911a4eeeb382b1f5caa80821a1377d4b8b4cec Mon Sep 17 00:00:00 2001 From: Chan <55515281+sichanyoo@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:20:53 -0800 Subject: [PATCH 7/9] chore: Bump aws-crt-swift version to v0.54.2 (#991) Co-authored-by: Sichan Yoo --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 27d79ff29..755b40342 100644 --- a/Package.swift +++ b/Package.swift @@ -56,7 +56,7 @@ let package = Package( ], dependencies: { var dependencies: [Package.Dependency] = [ - .package(url: "https://github.com/awslabs/aws-crt-swift.git", exact: "0.54.1"), + .package(url: "https://github.com/awslabs/aws-crt-swift.git", exact: "0.54.2"), .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), .package(url: "https://github.com/open-telemetry/opentelemetry-swift", from: "1.13.0"), ] From ce8d3ac13659df4bf5aedf35ffeea669c46f4766 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 7 Nov 2025 11:21:29 -0600 Subject: [PATCH 8/9] chore: Sort imports (#992) --- .../Config/ClientConfigDefaultsProvider.swift | 2 +- .../ClientRuntime/Config/Context+Config.swift | 2 +- .../DefaultSDKRuntimeConfiguration.swift | 8 ++--- .../Endpoints/DefaultEndpointResolver.swift | 2 +- .../Networking/Http/CRT/CRTClientEngine.swift | 16 ++++----- .../Http/CRT/HTTP2Stream+ByteStream.swift | 4 +-- .../Http/HTTPResponse+WireDataProviding.swift | 4 +-- .../Http/HttpClientConfiguration.swift | 4 +-- .../Networking/Http/HttpTelemetry.swift | 6 ++-- .../Middlewares/AuthSchemeMiddleware.swift | 8 ++--- .../Middlewares/ContentMD5Middleware.swift | 4 +-- .../Middlewares/DeserializeMiddleware.swift | 4 +-- .../Http/Middlewares/HeaderMiddleware.swift | 2 +- .../Http/Middlewares/LoggerMiddleware.swift | 2 +- .../Middlewares/MutateHeadersMiddleware.swift | 2 +- .../Middlewares/QueryItemMiddleware.swift | 2 +- .../RequestBody/BlobBodyMiddleware.swift | 4 +-- .../BlobStreamBodyMiddleware.swift | 6 ++-- .../RequestBody/BodyMiddleware.swift | 2 +- .../RequestBody/EnumBodyMiddleware.swift | 2 +- .../EventStreamBodyMiddleware.swift | 6 ++-- .../RequestBody/PayloadBodyMiddleware.swift | 6 ++-- .../RequestBody/StringBodyMiddleware.swift | 4 +-- .../Http/Middlewares/SignerMiddleware.swift | 6 ++-- .../URLSession/FoundationStreamBridge.swift | 18 +++++----- .../URLSession/URLSessionHTTPClient.swift | 36 +++++++++---------- .../Streaming/ByteStream+FileHandle.swift | 2 +- .../Streaming/ByteStream+Validating.swift | 6 ++-- .../Orchestrator/Orchestrator.swift | 8 ++--- .../Orchestrator/OrchestratorBuilder.swift | 4 +-- .../Orchestrator/OrchestratorTelemetry.swift | 4 +-- .../String+Extensions.swift | 4 +-- .../DefaultRetryErrorInfoProvider.swift | 12 +++---- .../TimestampFormatter.swift | 2 +- .../Providers/OpenTelemetry/OTelTracing.swift | 14 ++++---- .../Providers/OpenTelemetry/OTelUtils.swift | 4 +-- .../Telemetry/Tracing/TraceSpan.swift | 2 +- .../protocols/rpcv2cbor/RpcV2CborError.swift | 2 +- Sources/Smithy/ByteStream.swift | 2 +- Sources/SmithyCBOR/Reader/Reader.swift | 6 ++-- Sources/SmithyCBOR/Writer/Writer.swift | 4 +-- Sources/SmithyChecksums/CRC32.swift | 4 +-- Sources/SmithyChecksums/CRC32C.swift | 4 +-- Sources/SmithyChecksums/CRC64NVME.swift | 4 +-- .../SmithyChecksums/ChecksumAlgorithm.swift | 4 +-- Sources/SmithyChecksums/ChunkedReader.swift | 6 ++-- Sources/SmithyChecksums/ChunkedStream.swift | 6 ++-- Sources/SmithyChecksums/MD5.swift | 4 +-- Sources/SmithyChecksums/SHA1.swift | 4 +-- Sources/SmithyChecksums/SHA256.swift | 4 +-- .../ValidatingBufferedStream.swift | 4 +-- .../SmithyChecksumsAPI/Context+Checksum.swift | 2 +- .../DefaultMessageDecoder.swift | 6 ++-- .../DefaultMessageDecoderStream.swift | 2 +- .../DefaultMessageEncoder.swift | 2 +- .../DefaultMessageEncoderStream.swift | 2 +- Sources/SmithyEventStreams/Header+CRT.swift | 4 +-- Sources/SmithyEventStreams/Message+CRT.swift | 4 +-- .../Context+EventStreamsAPI.swift | 2 +- .../Context+EventStreamsAuthAPI.swift | 2 +- .../MessageDataSigner.swift | 2 +- .../MessageEncoderStream.swift | 2 +- Sources/SmithyFormURL/Writer.swift | 8 ++--- Sources/SmithyHTTPAPI/Context+HTTP.swift | 4 +-- Sources/SmithyHTTPAPI/Endpoint.swift | 2 +- .../SmithyHTTPAPI/EndpointPropertyValue.swift | 2 +- Sources/SmithyHTTPAPI/HTTPRequest.swift | 18 +++++----- Sources/SmithyHTTPAPI/HTTPResponse.swift | 4 +-- Sources/SmithyHTTPAPI/URL+getQueryItems.swift | 2 +- Sources/SmithyHTTPAuth/AWSSigningConfig.swift | 12 +++---- .../AuthSchemes/BearerTokenAuthScheme.swift | 2 +- Sources/SmithyHTTPAuth/CRTAdapters.swift | 8 ++--- ...DefaultIdentityResolverConfiguration.swift | 6 ++-- Sources/SmithyHTTPAuth/SigV4AuthScheme.swift | 8 ++--- Sources/SmithyHTTPAuth/SigV4Signer.swift | 26 +++++++------- .../Signers/BearerTokenSigner.swift | 6 ++-- Sources/SmithyHTTPAuthAPI/AuthScheme.swift | 2 +- .../Context/Context+Chunked.swift | 2 +- .../Context/Context+EstimatedSkew.swift | 4 +-- .../Context/Context+HTTPAuth.swift | 4 +-- .../Context/Context+RequestSignature.swift | 2 +- .../Context/SigningPropertyKeys.swift | 2 +- .../SelectedAuthScheme.swift | 4 +-- Sources/SmithyHTTPAuthAPI/Signer.swift | 2 +- .../SmithyHTTPClient/SdkHttpRequest+CRT.swift | 4 +-- ...dkHttpRequestBuilder+HTTPRequestBase.swift | 4 +-- .../AWSCredentialIdentity.swift | 2 +- .../AWSCredentialIdentityResolver.swift | 2 +- .../StaticAWSCredentialIdentityResolver.swift | 2 +- .../SmithyIdentity/BearerTokenIdentity.swift | 2 +- .../StaticBearerTokenIdentityResolver.swift | 2 +- .../Context+AuthSchemePreference.swift | 2 +- .../Context/Context+FlowType.swift | 2 +- .../Context/Context+IdentityResolver.swift | 2 +- Sources/SmithyJSON/Document+JSONUtils.swift | 2 +- .../Reader/Reader+JSONDeserialization.swift | 2 +- Sources/SmithyJSON/Reader/Reader.swift | 20 +++++------ Sources/SmithyJSON/Writer/Writer.swift | 10 +++--- Sources/SmithyReadWrite/SmithyReader.swift | 2 +- Sources/SmithyReadWrite/SmithyWriter.swift | 2 +- Sources/SmithyReadWrite/WritingClosure.swift | 2 +- .../ClientSideRateLimiter.swift | 2 +- .../DefaultRetryStrategy.swift | 4 +-- Sources/SmithyStreams/FileStream.swift | 2 +- .../SmithyStreams/StreamableHttpBody.swift | 6 ++-- Sources/SmithyTimestamps/DateFormatters.swift | 4 +-- .../TimestampSerdeUtils.swift | 2 +- Sources/SmithyXML/Reader/Reader+libxml2.swift | 2 +- Sources/SmithyXML/Reader/Reader.swift | 6 ++-- Sources/SmithyXML/Writer/Writer+libxml2.swift | 2 +- Sources/SmithyXML/Writer/Writer.swift | 6 ++-- 111 files changed, 271 insertions(+), 271 deletions(-) diff --git a/Sources/ClientRuntime/Config/ClientConfigDefaultsProvider.swift b/Sources/ClientRuntime/Config/ClientConfigDefaultsProvider.swift index fd6ed7864..cf2895c3b 100644 --- a/Sources/ClientRuntime/Config/ClientConfigDefaultsProvider.swift +++ b/Sources/ClientRuntime/Config/ClientConfigDefaultsProvider.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import protocol SmithyHTTPAPI.HTTPClient import SmithyIdentity import SmithyIdentityAPI -import protocol SmithyHTTPAPI.HTTPClient import struct SmithyRetries.DefaultRetryStrategy import struct SmithyRetries.ExponentialBackoffStrategy import struct SmithyRetriesAPI.RetryStrategyOptions diff --git a/Sources/ClientRuntime/Config/Context+Config.swift b/Sources/ClientRuntime/Config/Context+Config.swift index 7dc98f38d..126f9fd48 100644 --- a/Sources/ClientRuntime/Config/Context+Config.swift +++ b/Sources/ClientRuntime/Config/Context+Config.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Smithy.AttributeKey import class Smithy.Context import class Smithy.ContextBuilder -import struct Smithy.AttributeKey public extension Context { diff --git a/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift b/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift index 9d347b24f..21e48406f 100644 --- a/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift +++ b/Sources/ClientRuntime/Config/DefaultSDKRuntimeConfiguration.swift @@ -5,17 +5,17 @@ // SPDX-License-Identifier: Apache-2.0 // +import enum Smithy.ClientError import class Smithy.Context import protocol SmithyHTTPAPI.HTTPClient -import enum Smithy.ClientError import struct SmithyHTTPAuthAPI.AuthOption import protocol SmithyHTTPAuthAPI.AuthSchemeResolver import protocol SmithyHTTPAuthAPI.AuthSchemeResolverParameters -import protocol SmithyRetriesAPI.RetryStrategy -import protocol SmithyRetriesAPI.RetryErrorInfoProvider -import struct SmithyRetriesAPI.RetryStrategyOptions import struct SmithyRetries.DefaultRetryStrategy import struct SmithyRetries.ExponentialBackoffStrategy +import protocol SmithyRetriesAPI.RetryErrorInfoProvider +import protocol SmithyRetriesAPI.RetryStrategy +import struct SmithyRetriesAPI.RetryStrategyOptions public struct DefaultSDKRuntimeConfiguration { diff --git a/Sources/ClientRuntime/Endpoints/DefaultEndpointResolver.swift b/Sources/ClientRuntime/Endpoints/DefaultEndpointResolver.swift index 68423c024..a77b8ddc8 100644 --- a/Sources/ClientRuntime/Endpoints/DefaultEndpointResolver.swift +++ b/Sources/ClientRuntime/Endpoints/DefaultEndpointResolver.swift @@ -6,8 +6,8 @@ // import struct SmithyHTTPAPI.Endpoint -import struct SmithyHTTPAPI.Headers import enum SmithyHTTPAPI.EndpointPropertyValue +import struct SmithyHTTPAPI.Headers public struct DefaultEndpointResolver { diff --git a/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift b/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift index 460f08e2d..4eab0bf56 100644 --- a/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift +++ b/Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift @@ -3,23 +3,23 @@ * SPDX-License-Identifier: Apache-2.0. */ +import AwsCommonRuntimeKit import Foundation -import enum Smithy.URIScheme import struct Smithy.Attributes -import struct Smithy.SwiftLogger +import enum Smithy.ByteStreamError import protocol Smithy.LogAgent import enum Smithy.StreamError -import enum Smithy.ByteStreamError -import protocol SmithyHTTPAPI.HTTPClient -import struct SmithyHTTPAPI.Headers -import struct SmithyHTTPAPI.Endpoint +import struct Smithy.SwiftLogger +import enum Smithy.URIScheme +import class SmithyChecksums.ChunkedStream import enum SmithyHTTPAPI.ALPNProtocol +import struct SmithyHTTPAPI.Endpoint +import struct SmithyHTTPAPI.Headers +import protocol SmithyHTTPAPI.HTTPClient import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPResponse import enum SmithyHTTPAPI.HTTPStatusCode -import class SmithyChecksums.ChunkedStream import class SmithyStreams.BufferedStream -import AwsCommonRuntimeKit #if os(Linux) import Glibc #elseif !os(Windows) diff --git a/Sources/ClientRuntime/Networking/Http/CRT/HTTP2Stream+ByteStream.swift b/Sources/ClientRuntime/Networking/Http/CRT/HTTP2Stream+ByteStream.swift index f2a7cd79d..6e3192c82 100644 --- a/Sources/ClientRuntime/Networking/Http/CRT/HTTP2Stream+ByteStream.swift +++ b/Sources/ClientRuntime/Networking/Http/CRT/HTTP2Stream+ByteStream.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import enum Smithy.ByteStream -import struct Smithy.Attributes import AwsCommonRuntimeKit +import struct Smithy.Attributes +import enum Smithy.ByteStream extension HTTP2Stream { /// Returns the recommended size, in bytes, for the data to write diff --git a/Sources/ClientRuntime/Networking/Http/HTTPResponse+WireDataProviding.swift b/Sources/ClientRuntime/Networking/Http/HTTPResponse+WireDataProviding.swift index 38b514db5..9083b66f6 100644 --- a/Sources/ClientRuntime/Networking/Http/HTTPResponse+WireDataProviding.swift +++ b/Sources/ClientRuntime/Networking/Http/HTTPResponse+WireDataProviding.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import class SmithyHTTPAPI.HTTPResponse +import struct Foundation.Data import enum Smithy.ByteStream +import class SmithyHTTPAPI.HTTPResponse @_spi(SmithyReadWrite) import protocol SmithyReadWrite.WireDataProviding -import struct Foundation.Data @_spi(SmithyReadWrite) extension HTTPResponse: WireDataProviding { diff --git a/Sources/ClientRuntime/Networking/Http/HttpClientConfiguration.swift b/Sources/ClientRuntime/Networking/Http/HttpClientConfiguration.swift index efdb14260..1f09b439a 100644 --- a/Sources/ClientRuntime/Networking/Http/HttpClientConfiguration.swift +++ b/Sources/ClientRuntime/Networking/Http/HttpClientConfiguration.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.TimeInterval import enum Smithy.URIScheme import struct SmithyHTTPAPI.Headers -import struct Foundation.TimeInterval -import AwsCommonRuntimeKit public class HttpClientConfiguration { diff --git a/Sources/ClientRuntime/Networking/Http/HttpTelemetry.swift b/Sources/ClientRuntime/Networking/Http/HttpTelemetry.swift index d944a2c7a..900747f75 100644 --- a/Sources/ClientRuntime/Networking/Http/HttpTelemetry.swift +++ b/Sources/ClientRuntime/Networking/Http/HttpTelemetry.swift @@ -3,10 +3,10 @@ * SPDX-License-Identifier: Apache-2.0. */ -import protocol SmithyHTTPAPI.HTTPClient -import struct Smithy.Attributes -import struct Smithy.AttributeKey import class Foundation.NSRecursiveLock +import struct Smithy.AttributeKey +import struct Smithy.Attributes +import protocol SmithyHTTPAPI.HTTPClient /// Container for HTTPClient telemetry, including configurable attributes and names. /// diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift index 34ac08c89..d87df1899 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift @@ -5,14 +5,14 @@ // SPDX-License-Identifier: Apache-2.0 // -import enum Smithy.ClientError -import struct Smithy.Attributes import struct Smithy.AttributeKey +import struct Smithy.Attributes +import enum Smithy.ClientError import class Smithy.Context import class SmithyHTTPAPI.HTTPRequestBuilder -import struct SmithyHTTPAuthAPI.SelectedAuthScheme -import protocol SmithyHTTPAuthAPI.AuthScheme import struct SmithyHTTPAuth.DefaultIdentityResolverConfiguration +import protocol SmithyHTTPAuthAPI.AuthScheme +import struct SmithyHTTPAuthAPI.SelectedAuthScheme public struct AuthSchemeMiddleware { public let id: String = "AuthSchemeMiddleware" diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/ContentMD5Middleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/ContentMD5Middleware.swift index b272a90a4..3ec3ca191 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/ContentMD5Middleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/ContentMD5Middleware.swift @@ -1,10 +1,10 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0. -import Smithy -import enum SmithyChecksumsAPI.ChecksumAlgorithm import AwsCommonRuntimeKit +import Smithy import SmithyChecksums +import enum SmithyChecksumsAPI.ChecksumAlgorithm import SmithyHTTPAPI public struct ContentMD5Middleware { diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/DeserializeMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/DeserializeMiddleware.swift index d4fe79fcf..1f17a9777 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/DeserializeMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/DeserializeMiddleware.swift @@ -5,8 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // -import SmithyHTTPAPI -@_spi(SmithyReadWrite) import SmithyReadWrite import struct Foundation.Date import class Foundation.DateFormatter import struct Foundation.Locale @@ -15,6 +13,8 @@ import struct Foundation.TimeZone import struct Foundation.UUID import class Smithy.Context import protocol Smithy.ResponseMessageDeserializer +import SmithyHTTPAPI +@_spi(SmithyReadWrite) import SmithyReadWrite @_spi(SmithyReadWrite) public struct DeserializeMiddleware { diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/HeaderMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/HeaderMiddleware.swift index 7a31d0622..fc7b34870 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/HeaderMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/HeaderMiddleware.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import class Smithy.Context import protocol Smithy.RequestMessageSerializer import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPRequestBuilder -import class Smithy.Context public struct HeaderMiddleware { public let id: String = "\(String(describing: OperationStackInput.self))HeadersMiddleware" diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/LoggerMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/LoggerMiddleware.swift index d250873ca..901ada485 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/LoggerMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/LoggerMiddleware.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol Smithy.LogAgent import class Smithy.Context +import protocol Smithy.LogAgent import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPResponse diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/MutateHeadersMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/MutateHeadersMiddleware.swift index d74e85c25..613e379aa 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/MutateHeadersMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/MutateHeadersMiddleware.swift @@ -3,8 +3,8 @@ import class Smithy.Context import struct SmithyHTTPAPI.Headers -import class SmithyHTTPAPI.HTTPRequestBuilder import class SmithyHTTPAPI.HTTPRequest +import class SmithyHTTPAPI.HTTPRequestBuilder import class SmithyHTTPAPI.HTTPResponse public struct MutateHeadersMiddleware { diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/QueryItemMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/QueryItemMiddleware.swift index 4207806a2..6d569684d 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/QueryItemMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/QueryItemMiddleware.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol Smithy.RequestMessageSerializer import class Smithy.Context +import protocol Smithy.RequestMessageSerializer import SmithyHTTPAPI public struct QueryItemMiddleware { diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BlobBodyMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BlobBodyMiddleware.swift index 312cb3318..f1b1bf6ff 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BlobBodyMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BlobBodyMiddleware.swift @@ -5,11 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol Smithy.RequestMessageSerializer +import struct Foundation.Data import class Smithy.Context +import protocol Smithy.RequestMessageSerializer import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPRequestBuilder -import struct Foundation.Data public struct BlobBodyMiddleware { public let id: Swift.String = "BlobBodyMiddleware" diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BlobStreamBodyMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BlobStreamBodyMiddleware.swift index 39ebff846..df0eeee63 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BlobStreamBodyMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BlobStreamBodyMiddleware.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol Smithy.RequestMessageSerializer -import class Smithy.Context +import struct Foundation.Data import enum Smithy.ByteStream +import class Smithy.Context +import protocol Smithy.RequestMessageSerializer import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPRequestBuilder -import struct Foundation.Data public struct BlobStreamBodyMiddleware { public let id: Swift.String = "BlobStreamBodyMiddleware" diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BodyMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BodyMiddleware.swift index 46308d05e..dc35cccc0 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BodyMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/BodyMiddleware.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.Data import Smithy import SmithyHTTPAPI -import struct Foundation.Data @_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter @_spi(SmithyReadWrite) import typealias SmithyReadWrite.WritingClosure diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/EnumBodyMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/EnumBodyMiddleware.swift index 03000f8bc..1445f8e70 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/EnumBodyMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/RequestBody/EnumBodyMiddleware.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.Data import class Smithy.Context import protocol Smithy.RequestMessageSerializer -import struct Foundation.Data import SmithyHTTPAPI public struct EnumBodyMiddleware { diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/SignerMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/SignerMiddleware.swift index 1e7432eaa..6edab561a 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/SignerMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/SignerMiddleware.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // -import class Smithy.Context -import enum Smithy.ClientError import Foundation +import struct Smithy.AttributeKey +import enum Smithy.ClientError +import class Smithy.Context import SmithyHTTPAPI import SmithyHTTPAuthAPI -import struct Smithy.AttributeKey public struct SignerMiddleware { public let id: String = "SignerMiddleware" diff --git a/Sources/ClientRuntime/Networking/Http/URLSession/FoundationStreamBridge.swift b/Sources/ClientRuntime/Networking/Http/URLSession/FoundationStreamBridge.swift index da8a55133..bbfacedd1 100644 --- a/Sources/ClientRuntime/Networking/Http/URLSession/FoundationStreamBridge.swift +++ b/Sources/ClientRuntime/Networking/Http/URLSession/FoundationStreamBridge.swift @@ -7,21 +7,21 @@ #if os(iOS) || os(macOS) || os(watchOS) || os(tvOS) || os(visionOS) -import protocol Smithy.LogAgent -import protocol Smithy.ReadableStream -import struct Smithy.Attributes import func Foundation.CFWriteStreamSetDispatchQueue +import struct Foundation.Data import class Foundation.DispatchQueue -import class Foundation.NSObject -import class Foundation.Stream import class Foundation.InputStream +import class Foundation.NSObject import class Foundation.OutputStream -import class Foundation.Thread import class Foundation.RunLoop -import class Foundation.Timer -import struct Foundation.TimeInterval -import struct Foundation.Data +import class Foundation.Stream import protocol Foundation.StreamDelegate +import class Foundation.Thread +import struct Foundation.TimeInterval +import class Foundation.Timer +import struct Smithy.Attributes +import protocol Smithy.LogAgent +import protocol Smithy.ReadableStream /// Reads data from a smithy-swift native `ReadableStream` and streams the data through to a Foundation `InputStream`. /// diff --git a/Sources/ClientRuntime/Networking/Http/URLSession/URLSessionHTTPClient.swift b/Sources/ClientRuntime/Networking/Http/URLSession/URLSessionHTTPClient.swift index 3b9ad4849..9a7b475ae 100644 --- a/Sources/ClientRuntime/Networking/Http/URLSession/URLSessionHTTPClient.swift +++ b/Sources/ClientRuntime/Networking/Http/URLSession/URLSessionHTTPClient.swift @@ -7,41 +7,41 @@ #if os(iOS) || os(macOS) || os(watchOS) || os(tvOS) || os(visionOS) -import struct Smithy.Attributes -import struct Smithy.SwiftLogger -import protocol Smithy.LogAgent -import protocol SmithyHTTPAPI.HTTPClient -import struct SmithyHTTPAPI.Headers -import class SmithyHTTPAPI.HTTPResponse -import class SmithyHTTPAPI.HTTPRequest -import enum SmithyHTTPAPI.HTTPStatusCode -import protocol Smithy.ReadableStream -import enum Smithy.ByteStream -import class SmithyStreams.BufferedStream -import struct Foundation.Date +import AwsCommonRuntimeKit import class Foundation.Bundle +import struct Foundation.Data +import struct Foundation.Date +import class Foundation.HTTPURLResponse import class Foundation.InputStream import class Foundation.NSObject import class Foundation.NSRecursiveLock import var Foundation.NSURLAuthenticationMethodClientCertificate import var Foundation.NSURLAuthenticationMethodServerTrust +import struct Foundation.TimeInterval import class Foundation.URLAuthenticationChallenge import struct Foundation.URLComponents import class Foundation.URLCredential import struct Foundation.URLQueryItem import struct Foundation.URLRequest import class Foundation.URLResponse -import class Foundation.HTTPURLResponse -import struct Foundation.TimeInterval import class Foundation.URLSession import class Foundation.URLSessionConfiguration +import protocol Foundation.URLSessionDataDelegate +import class Foundation.URLSessionDataTask import class Foundation.URLSessionTask import class Foundation.URLSessionTaskMetrics -import class Foundation.URLSessionDataTask -import protocol Foundation.URLSessionDataDelegate -import struct Foundation.Data -import AwsCommonRuntimeKit import Security +import struct Smithy.Attributes +import enum Smithy.ByteStream +import protocol Smithy.LogAgent +import protocol Smithy.ReadableStream +import struct Smithy.SwiftLogger +import struct SmithyHTTPAPI.Headers +import protocol SmithyHTTPAPI.HTTPClient +import class SmithyHTTPAPI.HTTPRequest +import class SmithyHTTPAPI.HTTPResponse +import enum SmithyHTTPAPI.HTTPStatusCode +import class SmithyStreams.BufferedStream /// A client that can be used to make requests to AWS services using `Foundation`'s `URLSession` HTTP client. /// diff --git a/Sources/ClientRuntime/Networking/Streaming/ByteStream+FileHandle.swift b/Sources/ClientRuntime/Networking/Streaming/ByteStream+FileHandle.swift index 1e3af77e3..03926371c 100644 --- a/Sources/ClientRuntime/Networking/Streaming/ByteStream+FileHandle.swift +++ b/Sources/ClientRuntime/Networking/Streaming/ByteStream+FileHandle.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import class Foundation.FileHandle import enum Smithy.ByteStream import class SmithyStreams.FileStream -import class Foundation.FileHandle extension ByteStream { diff --git a/Sources/ClientRuntime/Networking/Streaming/ByteStream+Validating.swift b/Sources/ClientRuntime/Networking/Streaming/ByteStream+Validating.swift index 0913d8f91..0ef7894fd 100644 --- a/Sources/ClientRuntime/Networking/Streaming/ByteStream+Validating.swift +++ b/Sources/ClientRuntime/Networking/Streaming/ByteStream+Validating.swift @@ -5,11 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol Smithy.Stream import enum Smithy.ByteStream -import class SmithyStreams.BufferedStream -import enum SmithyChecksumsAPI.ChecksumAlgorithm +import protocol Smithy.Stream import class SmithyChecksums.ValidatingBufferedStream +import enum SmithyChecksumsAPI.ChecksumAlgorithm +import class SmithyStreams.BufferedStream extension ByteStream { diff --git a/Sources/ClientRuntime/Orchestrator/Orchestrator.swift b/Sources/ClientRuntime/Orchestrator/Orchestrator.swift index 313c56f36..526481448 100644 --- a/Sources/ClientRuntime/Orchestrator/Orchestrator.swift +++ b/Sources/ClientRuntime/Orchestrator/Orchestrator.swift @@ -7,15 +7,15 @@ import struct Foundation.Date import struct Foundation.TimeInterval -import class Smithy.Context +import struct Smithy.AttributeKey +import struct Smithy.Attributes import enum Smithy.ClientError +import class Smithy.Context import protocol Smithy.RequestMessage import protocol Smithy.ResponseMessage -import struct Smithy.AttributeKey -import struct Smithy.Attributes import SmithyHTTPAPI -import protocol SmithyRetriesAPI.RetryStrategy import struct SmithyRetriesAPI.RetryErrorInfo +import protocol SmithyRetriesAPI.RetryStrategy /// Orchestrates operation execution /// diff --git a/Sources/ClientRuntime/Orchestrator/OrchestratorBuilder.swift b/Sources/ClientRuntime/Orchestrator/OrchestratorBuilder.swift index e9280794c..4b8835c11 100644 --- a/Sources/ClientRuntime/Orchestrator/OrchestratorBuilder.swift +++ b/Sources/ClientRuntime/Orchestrator/OrchestratorBuilder.swift @@ -10,12 +10,12 @@ import struct Foundation.TimeInterval import class Smithy.Context import class Smithy.ContextBuilder import protocol Smithy.RequestMessage -import protocol Smithy.ResponseMessage import protocol Smithy.RequestMessageSerializer +import protocol Smithy.ResponseMessage import protocol Smithy.ResponseMessageDeserializer import struct SmithyHTTPAuthAPI.SelectedAuthScheme -import protocol SmithyRetriesAPI.RetryStrategy import struct SmithyRetriesAPI.RetryErrorInfo +import protocol SmithyRetriesAPI.RetryStrategy /// Builds an Orchestrator, combining runtime components, interceptors, serializers, and deserializers. /// diff --git a/Sources/ClientRuntime/Orchestrator/OrchestratorTelemetry.swift b/Sources/ClientRuntime/Orchestrator/OrchestratorTelemetry.swift index c073f54de..6dcc0e5f3 100644 --- a/Sources/ClientRuntime/Orchestrator/OrchestratorTelemetry.swift +++ b/Sources/ClientRuntime/Orchestrator/OrchestratorTelemetry.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import class Smithy.Context -import struct Smithy.Attributes import struct Smithy.AttributeKey +import struct Smithy.Attributes +import class Smithy.Context import enum SmithyHTTPAPI.SmithyHTTPAPIKeys /// Container for Orchestrator telemetry, including configurable attributes and names. diff --git a/Sources/ClientRuntime/PrimitiveTypeExtensions/String+Extensions.swift b/Sources/ClientRuntime/PrimitiveTypeExtensions/String+Extensions.swift index ea1b3cc0e..96ee02b5f 100644 --- a/Sources/ClientRuntime/PrimitiveTypeExtensions/String+Extensions.swift +++ b/Sources/ClientRuntime/PrimitiveTypeExtensions/String+Extensions.swift @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0. */ -import enum Smithy.ClientError -import struct Foundation.Data import AwsCommonRuntimeKit +import struct Foundation.Data +import enum Smithy.ClientError extension StringProtocol where Self.Index == String.Index { func escape(_ characterSet: [(character: String, escapedCharacter: String)]) -> String { diff --git a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift index 250adae58..e7f16265e 100644 --- a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift +++ b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift @@ -5,15 +5,15 @@ // SPDX-License-Identifier: Apache-2.0 // +import enum AwsCommonRuntimeKit.CommonRunTimeError +import struct AwsCommonRuntimeKit.CRTError +import class Foundation.NSError +import var Foundation.NSURLErrorDomain +import struct Foundation.TimeInterval import enum SmithyHTTPAPI.HTTPStatusCode import struct SmithyRetriesAPI.RetryErrorInfo -import enum SmithyRetriesAPI.RetryErrorType import protocol SmithyRetriesAPI.RetryErrorInfoProvider -import struct Foundation.TimeInterval -import class Foundation.NSError -import var Foundation.NSURLErrorDomain -import struct AwsCommonRuntimeKit.CRTError -import enum AwsCommonRuntimeKit.CommonRunTimeError +import enum SmithyRetriesAPI.RetryErrorType public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider, Sendable { /// Returns information used to determine how & if to retry an error. diff --git a/Sources/ClientRuntime/Serialization/SerializationUtils/TimestampFormatter.swift b/Sources/ClientRuntime/Serialization/SerializationUtils/TimestampFormatter.swift index 1b0e6cced..c0e12294a 100644 --- a/Sources/ClientRuntime/Serialization/SerializationUtils/TimestampFormatter.swift +++ b/Sources/ClientRuntime/Serialization/SerializationUtils/TimestampFormatter.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter @_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat +@_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter @_spi(SmithyTimestamps) public typealias TimestampFormatter = SmithyTimestamps.TimestampFormatter diff --git a/Sources/ClientRuntime/Telemetry/Providers/OpenTelemetry/OTelTracing.swift b/Sources/ClientRuntime/Telemetry/Providers/OpenTelemetry/OTelTracing.swift index df095976c..cd068bb11 100644 --- a/Sources/ClientRuntime/Telemetry/Providers/OpenTelemetry/OTelTracing.swift +++ b/Sources/ClientRuntime/Telemetry/Providers/OpenTelemetry/OTelTracing.swift @@ -6,19 +6,19 @@ // #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) -// OpenTelemetryApi specific imports -@preconcurrency import protocol OpenTelemetryApi.Tracer +@preconcurrency import enum OpenTelemetryApi.AttributeValue @preconcurrency import protocol OpenTelemetryApi.Span @preconcurrency import enum OpenTelemetryApi.SpanKind @preconcurrency import enum OpenTelemetryApi.Status -@preconcurrency import enum OpenTelemetryApi.AttributeValue +// OpenTelemetryApi specific imports +@preconcurrency import protocol OpenTelemetryApi.Tracer -// OpenTelemetrySdk specific imports -@preconcurrency import class OpenTelemetrySdk.TracerProviderSdk -@preconcurrency import class OpenTelemetrySdk.TracerProviderBuilder +@preconcurrency import struct OpenTelemetrySdk.Resource @preconcurrency import struct OpenTelemetrySdk.SimpleSpanProcessor @preconcurrency import protocol OpenTelemetrySdk.SpanExporter -@preconcurrency import struct OpenTelemetrySdk.Resource +@preconcurrency import class OpenTelemetrySdk.TracerProviderBuilder +// OpenTelemetrySdk specific imports +@preconcurrency import class OpenTelemetrySdk.TracerProviderSdk // Smithy specific imports import struct Smithy.AttributeKey diff --git a/Sources/ClientRuntime/Telemetry/Providers/OpenTelemetry/OTelUtils.swift b/Sources/ClientRuntime/Telemetry/Providers/OpenTelemetry/OTelUtils.swift index 1246d2421..d95855e6d 100644 --- a/Sources/ClientRuntime/Telemetry/Providers/OpenTelemetry/OTelUtils.swift +++ b/Sources/ClientRuntime/Telemetry/Providers/OpenTelemetry/OTelUtils.swift @@ -6,13 +6,13 @@ // #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +@preconcurrency import class OpenTelemetryApi.AttributeArray // OpenTelemetryApi specific imports @preconcurrency import enum OpenTelemetryApi.AttributeValue -@preconcurrency import class OpenTelemetryApi.AttributeArray +import struct Smithy.AttributeKey // Smithy imports import struct Smithy.Attributes -import struct Smithy.AttributeKey extension Attributes { public func toOtelAttributes() -> [String: AttributeValue] { diff --git a/Sources/ClientRuntime/Telemetry/Tracing/TraceSpan.swift b/Sources/ClientRuntime/Telemetry/Tracing/TraceSpan.swift index fb24e2d8a..4bd55bb2c 100644 --- a/Sources/ClientRuntime/Telemetry/Tracing/TraceSpan.swift +++ b/Sources/ClientRuntime/Telemetry/Tracing/TraceSpan.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct Smithy.Attributes import struct Smithy.AttributeKey +import struct Smithy.Attributes /// A Trace Span represents a single unit of work which has a beginning and end time, and may be connected to other /// spans as part of a parent / child relationship. diff --git a/Sources/ClientRuntime/protocols/rpcv2cbor/RpcV2CborError.swift b/Sources/ClientRuntime/protocols/rpcv2cbor/RpcV2CborError.swift index 13f9a466f..3baf6d468 100644 --- a/Sources/ClientRuntime/protocols/rpcv2cbor/RpcV2CborError.swift +++ b/Sources/ClientRuntime/protocols/rpcv2cbor/RpcV2CborError.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import class SmithyHTTPAPI.HTTPResponse @_spi(SmithyReadWrite) import class SmithyCBOR.Reader +import class SmithyHTTPAPI.HTTPResponse public struct RpcV2CborError: BaseError { public let code: String diff --git a/Sources/Smithy/ByteStream.swift b/Sources/Smithy/ByteStream.swift index 9a13b3338..d1d1cd1ad 100644 --- a/Sources/Smithy/ByteStream.swift +++ b/Sources/Smithy/ByteStream.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import class Foundation.FileHandle import struct Foundation.Data +import class Foundation.FileHandle public enum ByteStream: Sendable { case data(Data?) diff --git a/Sources/SmithyCBOR/Reader/Reader.swift b/Sources/SmithyCBOR/Reader/Reader.swift index 813bda173..497a18c05 100644 --- a/Sources/SmithyCBOR/Reader/Reader.swift +++ b/Sources/SmithyCBOR/Reader/Reader.swift @@ -8,11 +8,11 @@ import AwsCommonRuntimeKit import Foundation -@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyReader -@_spi(SmithyReadWrite) import enum SmithyReadWrite.ReaderError -@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter @_spi(Smithy) import struct Smithy.Document @_spi(Smithy) import protocol Smithy.SmithyDocument +@_spi(SmithyReadWrite) import enum SmithyReadWrite.ReaderError +@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyReader +@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter @_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat @_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter diff --git a/Sources/SmithyCBOR/Writer/Writer.swift b/Sources/SmithyCBOR/Writer/Writer.swift index 01a2577ec..641fdfe08 100644 --- a/Sources/SmithyCBOR/Writer/Writer.swift +++ b/Sources/SmithyCBOR/Writer/Writer.swift @@ -8,11 +8,11 @@ import AwsCommonRuntimeKit import Foundation +@_spi(Smithy) import struct Smithy.Document +@_spi(Smithy) import protocol Smithy.SmithyDocument @_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyReader @_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter @_spi(SmithyReadWrite) import enum SmithyReadWrite.WriterError -@_spi(Smithy) import struct Smithy.Document -@_spi(Smithy) import protocol Smithy.SmithyDocument @_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat @_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter diff --git a/Sources/SmithyChecksums/CRC32.swift b/Sources/SmithyChecksums/CRC32.swift index 713020669..2d0c3fa7f 100644 --- a/Sources/SmithyChecksums/CRC32.swift +++ b/Sources/SmithyChecksums/CRC32.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.HashResult -import struct Foundation.Data -import AwsCommonRuntimeKit class CRC32 { let checksumName = "crc32" diff --git a/Sources/SmithyChecksums/CRC32C.swift b/Sources/SmithyChecksums/CRC32C.swift index 134e7c951..8f260870f 100644 --- a/Sources/SmithyChecksums/CRC32C.swift +++ b/Sources/SmithyChecksums/CRC32C.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.HashResult -import struct Foundation.Data -import AwsCommonRuntimeKit class CRC32C { let checksumName = "crc32c" diff --git a/Sources/SmithyChecksums/CRC64NVME.swift b/Sources/SmithyChecksums/CRC64NVME.swift index c38b8848f..58fa84661 100644 --- a/Sources/SmithyChecksums/CRC64NVME.swift +++ b/Sources/SmithyChecksums/CRC64NVME.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.HashResult -import struct Foundation.Data -import AwsCommonRuntimeKit class CRC64NVME { let checksumName = "crc64nvme" diff --git a/Sources/SmithyChecksums/ChecksumAlgorithm.swift b/Sources/SmithyChecksums/ChecksumAlgorithm.swift index be36d3015..e53864347 100644 --- a/Sources/SmithyChecksums/ChecksumAlgorithm.swift +++ b/Sources/SmithyChecksums/ChecksumAlgorithm.swift @@ -3,11 +3,11 @@ * SPDX-License-Identifier: Apache-2.0. */ +import AwsCommonRuntimeKit +import struct Foundation.Data import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.ChecksumAlgorithm import enum SmithyChecksumsAPI.HashResult -import struct Foundation.Data -import AwsCommonRuntimeKit public enum HashError: Error { case invalidInput diff --git a/Sources/SmithyChecksums/ChunkedReader.swift b/Sources/SmithyChecksums/ChunkedReader.swift index 2a9fae77a..941b09e2c 100644 --- a/Sources/SmithyChecksums/ChunkedReader.swift +++ b/Sources/SmithyChecksums/ChunkedReader.swift @@ -5,13 +5,13 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data +import Smithy import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.ChecksumAlgorithm import struct SmithyHTTPAPI.Headers -import AwsCommonRuntimeKit import SmithyHTTPClient -import struct Foundation.Data -import Smithy public class ChunkedReader { private var stream: ReadableStream diff --git a/Sources/SmithyChecksums/ChunkedStream.swift b/Sources/SmithyChecksums/ChunkedStream.swift index 4b7b1cc37..5583eda82 100644 --- a/Sources/SmithyChecksums/ChunkedStream.swift +++ b/Sources/SmithyChecksums/ChunkedStream.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data +import class Smithy.Context import protocol Smithy.Stream import struct SmithyHTTPAPI.Headers -import struct Foundation.Data -import AwsCommonRuntimeKit import class SmithyStreams.BufferedStream -import class Smithy.Context /// Reads data from the input stream, chunks it, and passes it out through its output stream. /// diff --git a/Sources/SmithyChecksums/MD5.swift b/Sources/SmithyChecksums/MD5.swift index f88325d8f..2c5e5e98f 100644 --- a/Sources/SmithyChecksums/MD5.swift +++ b/Sources/SmithyChecksums/MD5.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.HashResult -import struct Foundation.Data -import AwsCommonRuntimeKit class MD5 { let checksumName = "md5" diff --git a/Sources/SmithyChecksums/SHA1.swift b/Sources/SmithyChecksums/SHA1.swift index 748f8005b..2777163e5 100644 --- a/Sources/SmithyChecksums/SHA1.swift +++ b/Sources/SmithyChecksums/SHA1.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.HashResult -import struct Foundation.Data -import AwsCommonRuntimeKit class SHA1 { let checksumName = "sha1" diff --git a/Sources/SmithyChecksums/SHA256.swift b/Sources/SmithyChecksums/SHA256.swift index 4763ad9c4..6bebd330d 100644 --- a/Sources/SmithyChecksums/SHA256.swift +++ b/Sources/SmithyChecksums/SHA256.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.HashResult -import struct Foundation.Data -import AwsCommonRuntimeKit class SHA256 { let checksumName = "sha256" diff --git a/Sources/SmithyChecksums/ValidatingBufferedStream.swift b/Sources/SmithyChecksums/ValidatingBufferedStream.swift index dbe2c92b7..e4beaaac5 100644 --- a/Sources/SmithyChecksums/ValidatingBufferedStream.swift +++ b/Sources/SmithyChecksums/ValidatingBufferedStream.swift @@ -5,11 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data import protocol Smithy.Stream import protocol SmithyChecksumsAPI.Checksum import enum SmithyChecksumsAPI.ChecksumAlgorithm -import struct Foundation.Data -import AwsCommonRuntimeKit import class SmithyStreams.BufferedStream public class ValidatingBufferedStream: @unchecked Sendable { diff --git a/Sources/SmithyChecksumsAPI/Context+Checksum.swift b/Sources/SmithyChecksumsAPI/Context+Checksum.swift index d591de4ff..034101d1d 100644 --- a/Sources/SmithyChecksumsAPI/Context+Checksum.swift +++ b/Sources/SmithyChecksumsAPI/Context+Checksum.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import class Smithy.Context import struct Smithy.AttributeKey +import class Smithy.Context public extension Context { diff --git a/Sources/SmithyEventStreams/DefaultMessageDecoder.swift b/Sources/SmithyEventStreams/DefaultMessageDecoder.swift index 8a7549a01..8c016b8ad 100644 --- a/Sources/SmithyEventStreams/DefaultMessageDecoder.swift +++ b/Sources/SmithyEventStreams/DefaultMessageDecoder.swift @@ -5,13 +5,13 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit +import struct Foundation.Data import Smithy import enum SmithyEventStreamsAPI.EventStreamError -import struct SmithyEventStreamsAPI.Message import struct SmithyEventStreamsAPI.Header +import struct SmithyEventStreamsAPI.Message import protocol SmithyEventStreamsAPI.MessageDecoder -import AwsCommonRuntimeKit -import struct Foundation.Data /// AWS implementation of `MessageDecoder` for decoding event stream messages /// Note: This is class because struct does not allow using `self` in closure diff --git a/Sources/SmithyEventStreams/DefaultMessageDecoderStream.swift b/Sources/SmithyEventStreams/DefaultMessageDecoderStream.swift index a95d6b2ca..f06c907db 100644 --- a/Sources/SmithyEventStreams/DefaultMessageDecoderStream.swift +++ b/Sources/SmithyEventStreams/DefaultMessageDecoderStream.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.Data import Smithy import SmithyEventStreamsAPI import SmithyEventStreamsAuthAPI -import struct Foundation.Data /// Stream adapter that decodes input data into `EventStream.Message` objects. public struct DefaultMessageDecoderStream: MessageDecoderStream, Sendable { diff --git a/Sources/SmithyEventStreams/DefaultMessageEncoder.swift b/Sources/SmithyEventStreams/DefaultMessageEncoder.swift index 315f5534a..61642694e 100644 --- a/Sources/SmithyEventStreams/DefaultMessageEncoder.swift +++ b/Sources/SmithyEventStreams/DefaultMessageEncoder.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.Data import struct SmithyEventStreamsAPI.Message import protocol SmithyEventStreamsAPI.MessageEncoder -import struct Foundation.Data /// Encodes a `Message` into a `Data` object /// to be sent over the wire. diff --git a/Sources/SmithyEventStreams/DefaultMessageEncoderStream.swift b/Sources/SmithyEventStreams/DefaultMessageEncoderStream.swift index a48245c99..5f26eebad 100644 --- a/Sources/SmithyEventStreams/DefaultMessageEncoderStream.swift +++ b/Sources/SmithyEventStreams/DefaultMessageEncoderStream.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.Data import Smithy import SmithyEventStreamsAPI import SmithyEventStreamsAuthAPI -import struct Foundation.Data /// Stream adapter that encodes input into `Data` objects. public class DefaultMessageEncoderStream: MessageEncoderStream, Stream, @unchecked Sendable { diff --git a/Sources/SmithyEventStreams/Header+CRT.swift b/Sources/SmithyEventStreams/Header+CRT.swift index 19cd7c597..71aaa40a7 100644 --- a/Sources/SmithyEventStreams/Header+CRT.swift +++ b/Sources/SmithyEventStreams/Header+CRT.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct SmithyEventStreamsAPI.Header -import enum SmithyEventStreamsAPI.HeaderValue import AwsCommonRuntimeKit import Foundation +import struct SmithyEventStreamsAPI.Header +import enum SmithyEventStreamsAPI.HeaderValue extension Header { diff --git a/Sources/SmithyEventStreams/Message+CRT.swift b/Sources/SmithyEventStreams/Message+CRT.swift index 300200a82..f1e5be8a8 100644 --- a/Sources/SmithyEventStreams/Message+CRT.swift +++ b/Sources/SmithyEventStreams/Message+CRT.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit import enum SmithyEventStreamsAPI.EventStreamError -import enum SmithyEventStreamsAPI.MessageType import struct SmithyEventStreamsAPI.Message -import AwsCommonRuntimeKit +import enum SmithyEventStreamsAPI.MessageType extension Message { /// Parses the protocol level headers into a `MessageType` diff --git a/Sources/SmithyEventStreamsAPI/Context+EventStreamsAPI.swift b/Sources/SmithyEventStreamsAPI/Context+EventStreamsAPI.swift index 39b22e509..62e92623f 100644 --- a/Sources/SmithyEventStreamsAPI/Context+EventStreamsAPI.swift +++ b/Sources/SmithyEventStreamsAPI/Context+EventStreamsAPI.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import class Smithy.Context import struct Smithy.AttributeKey +import class Smithy.Context public extension Context { diff --git a/Sources/SmithyEventStreamsAuthAPI/Context+EventStreamsAuthAPI.swift b/Sources/SmithyEventStreamsAuthAPI/Context+EventStreamsAuthAPI.swift index 3cae68bf6..9430b4b8c 100644 --- a/Sources/SmithyEventStreamsAuthAPI/Context+EventStreamsAuthAPI.swift +++ b/Sources/SmithyEventStreamsAuthAPI/Context+EventStreamsAuthAPI.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import class Smithy.Context import struct Smithy.AttributeKey +import class Smithy.Context public extension Context { diff --git a/Sources/SmithyEventStreamsAuthAPI/MessageDataSigner.swift b/Sources/SmithyEventStreamsAuthAPI/MessageDataSigner.swift index b87606d7a..c4bc10e88 100644 --- a/Sources/SmithyEventStreamsAuthAPI/MessageDataSigner.swift +++ b/Sources/SmithyEventStreamsAuthAPI/MessageDataSigner.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.Data import struct Smithy.Attributes import struct SmithyEventStreamsAPI.Message -import struct Foundation.Data /// Protocol for signing messages. public protocol MessageDataSigner: Sendable { diff --git a/Sources/SmithyEventStreamsAuthAPI/MessageEncoderStream.swift b/Sources/SmithyEventStreamsAuthAPI/MessageEncoderStream.swift index e56b6ccbd..1afd6b8c8 100644 --- a/Sources/SmithyEventStreamsAuthAPI/MessageEncoderStream.swift +++ b/Sources/SmithyEventStreamsAuthAPI/MessageEncoderStream.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.Data import Smithy import SmithyEventStreamsAPI -import struct Foundation.Data /// Stream adapter that encodes input into `Data` objects that are encoded, signed events. public protocol MessageEncoderStream: Stream, AsyncSequence where Element == Data { diff --git a/Sources/SmithyFormURL/Writer.swift b/Sources/SmithyFormURL/Writer.swift index 2d1f76e9b..d27fe7e61 100644 --- a/Sources/SmithyFormURL/Writer.swift +++ b/Sources/SmithyFormURL/Writer.swift @@ -5,13 +5,13 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter +import struct Foundation.CharacterSet +import struct Foundation.Data +import struct Foundation.Date import protocol Smithy.SmithyDocument +@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter @_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat @_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter -import struct Foundation.Data -import struct Foundation.Date -import struct Foundation.CharacterSet @_spi(SmithyReadWrite) public final class Writer: SmithyWriter { diff --git a/Sources/SmithyHTTPAPI/Context+HTTP.swift b/Sources/SmithyHTTPAPI/Context+HTTP.swift index 2c5e48934..3d0465b34 100644 --- a/Sources/SmithyHTTPAPI/Context+HTTP.swift +++ b/Sources/SmithyHTTPAPI/Context+HTTP.swift @@ -5,11 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct Smithy.Attributes +import struct Foundation.TimeInterval import struct Smithy.AttributeKey +import struct Smithy.Attributes import class Smithy.Context import class Smithy.ContextBuilder -import struct Foundation.TimeInterval /// This extends `OperationContext` for all http middleware operations extension Context { diff --git a/Sources/SmithyHTTPAPI/Endpoint.swift b/Sources/SmithyHTTPAPI/Endpoint.swift index cce3a0ec4..ad0a66c51 100644 --- a/Sources/SmithyHTTPAPI/Endpoint.swift +++ b/Sources/SmithyHTTPAPI/Endpoint.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import enum AwsCommonRuntimeKit.EndpointProperty import Foundation import Smithy -import enum AwsCommonRuntimeKit.EndpointProperty public struct Endpoint: Sendable, Equatable { public let uri: URI diff --git a/Sources/SmithyHTTPAPI/EndpointPropertyValue.swift b/Sources/SmithyHTTPAPI/EndpointPropertyValue.swift index 3d6a9dd31..a05d0d611 100644 --- a/Sources/SmithyHTTPAPI/EndpointPropertyValue.swift +++ b/Sources/SmithyHTTPAPI/EndpointPropertyValue.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import enum AwsCommonRuntimeKit.EndpointProperty import Foundation import Smithy -import enum AwsCommonRuntimeKit.EndpointProperty public enum EndpointPropertyValue: Sendable, Equatable { case bool(Bool) diff --git a/Sources/SmithyHTTPAPI/HTTPRequest.swift b/Sources/SmithyHTTPAPI/HTTPRequest.swift index 5e6cde596..82350e381 100644 --- a/Sources/SmithyHTTPAPI/HTTPRequest.swift +++ b/Sources/SmithyHTTPAPI/HTTPRequest.swift @@ -5,18 +5,18 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.CharacterSet +import struct Foundation.Date +import struct Foundation.URLComponents +import struct Foundation.URLQueryItem +import enum Smithy.ByteStream +import enum Smithy.ClientError +import protocol Smithy.RequestMessage +import protocol Smithy.RequestMessageBuilder import struct Smithy.URI import class Smithy.URIBuilder -import enum Smithy.URIScheme import struct Smithy.URIQueryItem -import protocol Smithy.RequestMessage -import protocol Smithy.RequestMessageBuilder -import enum Smithy.ByteStream -import enum Smithy.ClientError -import struct Foundation.Date -import struct Foundation.CharacterSet -import struct Foundation.URLQueryItem -import struct Foundation.URLComponents +import enum Smithy.URIScheme // In Linux, Foundation.URLRequest is moved to FoundationNetworking. #if canImport(FoundationNetworking) import FoundationNetworking diff --git a/Sources/SmithyHTTPAPI/HTTPResponse.swift b/Sources/SmithyHTTPAPI/HTTPResponse.swift index 20e430c1e..009847a39 100644 --- a/Sources/SmithyHTTPAPI/HTTPResponse.swift +++ b/Sources/SmithyHTTPAPI/HTTPResponse.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import class Foundation.NSRecursiveLock +import enum Smithy.ByteStream import protocol Smithy.ResponseMessage import protocol Smithy.Stream -import enum Smithy.ByteStream -import class Foundation.NSRecursiveLock public final class HTTPResponse: ResponseMessage, @unchecked Sendable { private var lock = NSRecursiveLock() diff --git a/Sources/SmithyHTTPAPI/URL+getQueryItems.swift b/Sources/SmithyHTTPAPI/URL+getQueryItems.swift index 40f6c15f1..16d5bb786 100644 --- a/Sources/SmithyHTTPAPI/URL+getQueryItems.swift +++ b/Sources/SmithyHTTPAPI/URL+getQueryItems.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct Smithy.URIQueryItem import struct Foundation.URL import struct Foundation.URLComponents +import struct Smithy.URIQueryItem public func getQueryItems(url: URL) -> [URIQueryItem]? { URLComponents(url: url, resolvingAgainstBaseURL: false)? diff --git a/Sources/SmithyHTTPAuth/AWSSigningConfig.swift b/Sources/SmithyHTTPAuth/AWSSigningConfig.swift index 4765ca3f7..02e43e6c1 100644 --- a/Sources/SmithyHTTPAuth/AWSSigningConfig.swift +++ b/Sources/SmithyHTTPAuth/AWSSigningConfig.swift @@ -5,17 +5,17 @@ // SPDX-License-Identifier: Apache-2.0 // -import class SmithyIdentity.CRTAWSCredentialIdentity -import enum SmithyHTTPAuthAPI.SigningAlgorithm -import enum SmithyHTTPAuthAPI.AWSSignedBodyHeader -import enum SmithyHTTPAuthAPI.AWSSignedBodyValue -import enum SmithyHTTPAuthAPI.AWSSignatureType -import protocol SmithyIdentity.AWSCredentialIdentityResolver import struct Foundation.Date import struct Foundation.Locale import struct Foundation.TimeInterval +import enum SmithyHTTPAuthAPI.AWSSignatureType +import enum SmithyHTTPAuthAPI.AWSSignedBodyHeader +import enum SmithyHTTPAuthAPI.AWSSignedBodyValue +import enum SmithyHTTPAuthAPI.SigningAlgorithm import struct SmithyHTTPAuthAPI.SigningFlags import struct SmithyIdentity.AWSCredentialIdentity +import protocol SmithyIdentity.AWSCredentialIdentityResolver +import class SmithyIdentity.CRTAWSCredentialIdentity public struct AWSSigningConfig: Sendable { public let credentials: AWSCredentialIdentity? diff --git a/Sources/SmithyHTTPAuth/AuthSchemes/BearerTokenAuthScheme.swift b/Sources/SmithyHTTPAuth/AuthSchemes/BearerTokenAuthScheme.swift index a3fe6f2d1..b0e64aecd 100644 --- a/Sources/SmithyHTTPAuth/AuthSchemes/BearerTokenAuthScheme.swift +++ b/Sources/SmithyHTTPAuth/AuthSchemes/BearerTokenAuthScheme.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Smithy.Attributes import class Smithy.Context import protocol SmithyHTTPAuthAPI.AuthScheme import protocol SmithyHTTPAuthAPI.Signer -import struct Smithy.Attributes public struct BearerTokenAuthScheme: AuthScheme { public let schemeID: String = "smithy.api#httpBearerAuth" diff --git a/Sources/SmithyHTTPAuth/CRTAdapters.swift b/Sources/SmithyHTTPAuth/CRTAdapters.swift index 27c77c417..ae5e566f4 100644 --- a/Sources/SmithyHTTPAuth/CRTAdapters.swift +++ b/Sources/SmithyHTTPAuth/CRTAdapters.swift @@ -5,16 +5,16 @@ // SPDX-License-Identifier: Apache-2.0 // -import enum AwsCommonRuntimeKit.SigningAlgorithmType +import enum AwsCommonRuntimeKit.SignatureType import enum AwsCommonRuntimeKit.SignedBodyHeaderType import enum AwsCommonRuntimeKit.SignedBodyValue -import enum AwsCommonRuntimeKit.SignatureType +import enum AwsCommonRuntimeKit.SigningAlgorithmType import struct AwsCommonRuntimeKit.SigningConfig -import enum SmithyHTTPAuthAPI.SigningAlgorithm +import enum SmithyHTTPAuthAPI.AWSSignatureType import enum SmithyHTTPAuthAPI.AWSSignedBodyHeader import enum SmithyHTTPAuthAPI.AWSSignedBodyValue -import enum SmithyHTTPAuthAPI.AWSSignatureType +import enum SmithyHTTPAuthAPI.SigningAlgorithm import struct Foundation.Locale import class SmithyIdentity.CRTAWSCredentialIdentity diff --git a/Sources/SmithyHTTPAuth/DefaultIdentityResolverConfiguration.swift b/Sources/SmithyHTTPAuth/DefaultIdentityResolverConfiguration.swift index 1d1350348..c11dbf64a 100644 --- a/Sources/SmithyHTTPAuth/DefaultIdentityResolverConfiguration.swift +++ b/Sources/SmithyHTTPAuth/DefaultIdentityResolverConfiguration.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol SmithyIdentityAPI.IdentityResolver -import protocol SmithyHTTPAuthAPI.IdentityResolverConfiguration -import struct Smithy.Attributes import struct Smithy.AttributeKey +import struct Smithy.Attributes +import protocol SmithyHTTPAuthAPI.IdentityResolverConfiguration +import protocol SmithyIdentityAPI.IdentityResolver public struct DefaultIdentityResolverConfiguration: IdentityResolverConfiguration { let identityResolvers: Attributes diff --git a/Sources/SmithyHTTPAuth/SigV4AuthScheme.swift b/Sources/SmithyHTTPAuth/SigV4AuthScheme.swift index 62b4fb441..cac242fcb 100644 --- a/Sources/SmithyHTTPAuth/SigV4AuthScheme.swift +++ b/Sources/SmithyHTTPAuth/SigV4AuthScheme.swift @@ -5,13 +5,13 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Smithy.Attributes import class Smithy.Context -import enum SmithyHTTPAuthAPI.AWSSignedBodyHeader -import enum SmithyHTTPAuthAPI.SigningPropertyKeys +import SmithyChecksumsAPI import protocol SmithyHTTPAuthAPI.AuthScheme +import enum SmithyHTTPAuthAPI.AWSSignedBodyHeader import protocol SmithyHTTPAuthAPI.Signer -import struct Smithy.Attributes -import SmithyChecksumsAPI +import enum SmithyHTTPAuthAPI.SigningPropertyKeys public struct SigV4AuthScheme: AuthScheme { public let schemeID: String = "aws.auth#sigv4" diff --git a/Sources/SmithyHTTPAuth/SigV4Signer.swift b/Sources/SmithyHTTPAuth/SigV4Signer.swift index 9c04fbb9f..2f7c197e0 100644 --- a/Sources/SmithyHTTPAuth/SigV4Signer.swift +++ b/Sources/SmithyHTTPAuth/SigV4Signer.swift @@ -5,30 +5,30 @@ // SPDX-License-Identifier: Apache-2.0 // +import enum AwsCommonRuntimeKit.CommonRunTimeError +import class AwsCommonRuntimeKit.HTTPRequestBase +import class AwsCommonRuntimeKit.Signer +import struct AwsCommonRuntimeKit.SigningConfig import struct Foundation.Date import struct Foundation.TimeInterval import struct Foundation.URL -import class AwsCommonRuntimeKit.HTTPRequestBase -import class AwsCommonRuntimeKit.Signer +import struct Smithy.AttributeKey +import struct Smithy.Attributes +import enum Smithy.ClientError +import struct Smithy.SwiftLogger import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPRequestBuilder -import enum AwsCommonRuntimeKit.CommonRunTimeError -import enum Smithy.ClientError +import enum SmithyHTTPAuthAPI.AWSSignatureType import enum SmithyHTTPAuthAPI.AWSSignedBodyHeader import enum SmithyHTTPAuthAPI.AWSSignedBodyValue -import enum SmithyHTTPAuthAPI.AWSSignatureType +import protocol SmithyHTTPAuthAPI.Signer import enum SmithyHTTPAuthAPI.SigningAlgorithm +import struct SmithyHTTPAuthAPI.SigningFlags import enum SmithyHTTPAuthAPI.SigningPropertyKeys +import SmithyHTTPClient +import struct SmithyIdentity.AWSCredentialIdentity import protocol SmithyIdentity.AWSCredentialIdentityResolver import protocol SmithyIdentityAPI.Identity -import protocol SmithyHTTPAuthAPI.Signer -import struct AwsCommonRuntimeKit.SigningConfig -import struct Smithy.AttributeKey -import struct Smithy.Attributes -import struct Smithy.SwiftLogger -import struct SmithyIdentity.AWSCredentialIdentity -import struct SmithyHTTPAuthAPI.SigningFlags -import SmithyHTTPClient public class SigV4Signer: SmithyHTTPAuthAPI.Signer, @unchecked Sendable { public init() {} diff --git a/Sources/SmithyHTTPAuth/Signers/BearerTokenSigner.swift b/Sources/SmithyHTTPAuth/Signers/BearerTokenSigner.swift index d7e9fdaf8..fb3df6abc 100644 --- a/Sources/SmithyHTTPAuth/Signers/BearerTokenSigner.swift +++ b/Sources/SmithyHTTPAuth/Signers/BearerTokenSigner.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // -import class SmithyHTTPAPI.HTTPRequestBuilder +import struct Smithy.Attributes import enum Smithy.ClientError -import protocol SmithyIdentityAPI.Identity +import class SmithyHTTPAPI.HTTPRequestBuilder import protocol SmithyHTTPAuthAPI.Signer -import struct Smithy.Attributes import struct SmithyIdentity.BearerTokenIdentity +import protocol SmithyIdentityAPI.Identity /// The signer for HTTP bearer auth. /// Adds the Authorization header to the request using the resolved bearer token identity as its value. diff --git a/Sources/SmithyHTTPAuthAPI/AuthScheme.swift b/Sources/SmithyHTTPAuthAPI/AuthScheme.swift index a88e11d20..5831afa15 100644 --- a/Sources/SmithyHTTPAuthAPI/AuthScheme.swift +++ b/Sources/SmithyHTTPAuthAPI/AuthScheme.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Smithy.Attributes import class Smithy.Context import protocol SmithyIdentityAPI.IdentityResolver -import struct Smithy.Attributes public protocol AuthScheme: Sendable { var schemeID: String { get } diff --git a/Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift b/Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift index c50ebeaa4..f3c3e41fb 100644 --- a/Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift +++ b/Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import class Smithy.Context import struct Smithy.AttributeKey +import class Smithy.Context public extension Context { var isChunkedEligibleStream: Bool? { diff --git a/Sources/SmithyHTTPAuthAPI/Context/Context+EstimatedSkew.swift b/Sources/SmithyHTTPAuthAPI/Context/Context+EstimatedSkew.swift index acf77d628..4dcfec15c 100644 --- a/Sources/SmithyHTTPAuthAPI/Context/Context+EstimatedSkew.swift +++ b/Sources/SmithyHTTPAuthAPI/Context/Context+EstimatedSkew.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import class Smithy.Context -import class Smithy.ContextBuilder import struct Foundation.TimeInterval import struct Smithy.AttributeKey +import class Smithy.Context +import class Smithy.ContextBuilder public extension Context { var estimatedSkew: TimeInterval? { diff --git a/Sources/SmithyHTTPAuthAPI/Context/Context+HTTPAuth.swift b/Sources/SmithyHTTPAuthAPI/Context/Context+HTTPAuth.swift index fb5ed3708..76b894c43 100644 --- a/Sources/SmithyHTTPAuthAPI/Context/Context+HTTPAuth.swift +++ b/Sources/SmithyHTTPAuthAPI/Context/Context+HTTPAuth.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Smithy.AttributeKey +import struct Smithy.Attributes import class Smithy.Context import class Smithy.ContextBuilder -import struct Smithy.Attributes -import struct Smithy.AttributeKey public extension Context { diff --git a/Sources/SmithyHTTPAuthAPI/Context/Context+RequestSignature.swift b/Sources/SmithyHTTPAuthAPI/Context/Context+RequestSignature.swift index 82ceb9c27..9cfe4a8db 100644 --- a/Sources/SmithyHTTPAuthAPI/Context/Context+RequestSignature.swift +++ b/Sources/SmithyHTTPAuthAPI/Context/Context+RequestSignature.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Smithy.AttributeKey import class Smithy.Context import class Smithy.ContextBuilder -import struct Smithy.AttributeKey public extension Context { diff --git a/Sources/SmithyHTTPAuthAPI/Context/SigningPropertyKeys.swift b/Sources/SmithyHTTPAuthAPI/Context/SigningPropertyKeys.swift index 923ef7658..85d95c000 100644 --- a/Sources/SmithyHTTPAuthAPI/Context/SigningPropertyKeys.swift +++ b/Sources/SmithyHTTPAuthAPI/Context/SigningPropertyKeys.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct Smithy.AttributeKey import struct Foundation.TimeInterval +import struct Smithy.AttributeKey public enum SigningPropertyKeys { public static let signingName = AttributeKey(name: "SigningName") diff --git a/Sources/SmithyHTTPAuthAPI/SelectedAuthScheme.swift b/Sources/SmithyHTTPAuthAPI/SelectedAuthScheme.swift index 33e163b6c..b6a4f613e 100644 --- a/Sources/SmithyHTTPAuthAPI/SelectedAuthScheme.swift +++ b/Sources/SmithyHTTPAuthAPI/SelectedAuthScheme.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol SmithyIdentityAPI.Identity -import struct Smithy.Attributes import struct Smithy.AttributeKey +import struct Smithy.Attributes +import protocol SmithyIdentityAPI.Identity public struct SelectedAuthScheme: Sendable { public let schemeID: String diff --git a/Sources/SmithyHTTPAuthAPI/Signer.swift b/Sources/SmithyHTTPAuthAPI/Signer.swift index 0675d3765..71b500bbe 100644 --- a/Sources/SmithyHTTPAuthAPI/Signer.swift +++ b/Sources/SmithyHTTPAuthAPI/Signer.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Smithy.Attributes import class SmithyHTTPAPI.HTTPRequestBuilder import protocol SmithyIdentityAPI.Identity -import struct Smithy.Attributes public protocol Signer: Sendable { diff --git a/Sources/SmithyHTTPClient/SdkHttpRequest+CRT.swift b/Sources/SmithyHTTPClient/SdkHttpRequest+CRT.swift index 3c891b8d0..0324f0ea9 100644 --- a/Sources/SmithyHTTPClient/SdkHttpRequest+CRT.swift +++ b/Sources/SmithyHTTPClient/SdkHttpRequest+CRT.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit import struct Smithy.URI -import class SmithyStreams.StreamableHttpBody import class SmithyHTTPAPI.HTTPRequest -import AwsCommonRuntimeKit +import class SmithyStreams.StreamableHttpBody extension HTTPRequest { diff --git a/Sources/SmithyHTTPClient/SdkHttpRequestBuilder+HTTPRequestBase.swift b/Sources/SmithyHTTPClient/SdkHttpRequestBuilder+HTTPRequestBase.swift index b943b9caa..0da9372c5 100644 --- a/Sources/SmithyHTTPClient/SdkHttpRequestBuilder+HTTPRequestBase.swift +++ b/Sources/SmithyHTTPClient/SdkHttpRequestBuilder+HTTPRequestBase.swift @@ -5,13 +5,13 @@ // SPDX-License-Identifier: Apache-2.0 // +import AwsCommonRuntimeKit import struct Foundation.Date import struct Foundation.URLComponents import struct Smithy.URIQueryItem +import struct SmithyHTTPAPI.Headers import class SmithyHTTPAPI.HTTPRequest import class SmithyHTTPAPI.HTTPRequestBuilder -import struct SmithyHTTPAPI.Headers -import AwsCommonRuntimeKit extension HTTPRequestBuilder { diff --git a/Sources/SmithyIdentity/AWSCredentialIdentity.swift b/Sources/SmithyIdentity/AWSCredentialIdentity.swift index a5c7e7fed..803aeb65e 100644 --- a/Sources/SmithyIdentity/AWSCredentialIdentity.swift +++ b/Sources/SmithyIdentity/AWSCredentialIdentity.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol SmithyIdentityAPI.Identity import struct Foundation.Date import struct Smithy.Attributes +import protocol SmithyIdentityAPI.Identity /// A type representing AWS credentials for authenticating with an AWS service /// diff --git a/Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift b/Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift index f418e3805..1e3e47a8b 100644 --- a/Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift +++ b/Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift @@ -6,8 +6,8 @@ // import class AwsCommonRuntimeKit.CredentialsProvider -import protocol SmithyIdentityAPI.IdentityResolver import struct Smithy.Attributes +import protocol SmithyIdentityAPI.IdentityResolver /// A type that can provide credentials for authenticating with an AWS service public protocol AWSCredentialIdentityResolver: IdentityResolver where IdentityT == AWSCredentialIdentity {} diff --git a/Sources/SmithyIdentity/AWSCredentialIdentityResolvers/StaticAWSCredentialIdentityResolver.swift b/Sources/SmithyIdentity/AWSCredentialIdentityResolvers/StaticAWSCredentialIdentityResolver.swift index 87d018c8e..350bc15c3 100644 --- a/Sources/SmithyIdentity/AWSCredentialIdentityResolvers/StaticAWSCredentialIdentityResolver.swift +++ b/Sources/SmithyIdentity/AWSCredentialIdentityResolvers/StaticAWSCredentialIdentityResolver.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(ClientConfigDefaultIdentityResolver) import protocol SmithyIdentityAPI.ClientConfigDefaultIdentityResolver import struct Smithy.Attributes +@_spi(ClientConfigDefaultIdentityResolver) import protocol SmithyIdentityAPI.ClientConfigDefaultIdentityResolver /// A credential identity resolver that provides a fixed set of credentials public struct StaticAWSCredentialIdentityResolver: AWSCredentialIdentityResolver { diff --git a/Sources/SmithyIdentity/BearerTokenIdentity.swift b/Sources/SmithyIdentity/BearerTokenIdentity.swift index f7cf2ec81..c248a0cda 100644 --- a/Sources/SmithyIdentity/BearerTokenIdentity.swift +++ b/Sources/SmithyIdentity/BearerTokenIdentity.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import protocol SmithyIdentityAPI.Identity import struct Foundation.Date import struct Smithy.Attributes +import protocol SmithyIdentityAPI.Identity /// The type representing bearer token identity, used in HTTP bearer auth. public struct BearerTokenIdentity: Identity { diff --git a/Sources/SmithyIdentity/BearerTokenIdentityResolvers/StaticBearerTokenIdentityResolver.swift b/Sources/SmithyIdentity/BearerTokenIdentityResolvers/StaticBearerTokenIdentityResolver.swift index 792752515..cdd558456 100644 --- a/Sources/SmithyIdentity/BearerTokenIdentityResolvers/StaticBearerTokenIdentityResolver.swift +++ b/Sources/SmithyIdentity/BearerTokenIdentityResolvers/StaticBearerTokenIdentityResolver.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(ClientConfigDefaultIdentityResolver) import protocol SmithyIdentityAPI.ClientConfigDefaultIdentityResolver import struct Smithy.Attributes +@_spi(ClientConfigDefaultIdentityResolver) import protocol SmithyIdentityAPI.ClientConfigDefaultIdentityResolver /// The token identity resolver that returns a static token identity given to it at initialization. public struct StaticBearerTokenIdentityResolver: BearerTokenIdentityResolver { diff --git a/Sources/SmithyIdentityAPI/Context/Context+AuthSchemePreference.swift b/Sources/SmithyIdentityAPI/Context/Context+AuthSchemePreference.swift index 6df1e36a2..723a89af8 100644 --- a/Sources/SmithyIdentityAPI/Context/Context+AuthSchemePreference.swift +++ b/Sources/SmithyIdentityAPI/Context/Context+AuthSchemePreference.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct Smithy.Attributes import struct Smithy.AttributeKey +import struct Smithy.Attributes import class Smithy.Context import class Smithy.ContextBuilder diff --git a/Sources/SmithyIdentityAPI/Context/Context+FlowType.swift b/Sources/SmithyIdentityAPI/Context/Context+FlowType.swift index 3e5aa221a..74c1390e7 100644 --- a/Sources/SmithyIdentityAPI/Context/Context+FlowType.swift +++ b/Sources/SmithyIdentityAPI/Context/Context+FlowType.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Smithy.AttributeKey import class Smithy.Context import class Smithy.ContextBuilder -import struct Smithy.AttributeKey public let flowTypeKey = AttributeKey(name: "FlowType") diff --git a/Sources/SmithyIdentityAPI/Context/Context+IdentityResolver.swift b/Sources/SmithyIdentityAPI/Context/Context+IdentityResolver.swift index 73617f193..c9861b2bc 100644 --- a/Sources/SmithyIdentityAPI/Context/Context+IdentityResolver.swift +++ b/Sources/SmithyIdentityAPI/Context/Context+IdentityResolver.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct Smithy.Attributes import struct Smithy.AttributeKey +import struct Smithy.Attributes import class Smithy.Context import class Smithy.ContextBuilder diff --git a/Sources/SmithyJSON/Document+JSONUtils.swift b/Sources/SmithyJSON/Document+JSONUtils.swift index dd0386229..a7dcc4d86 100644 --- a/Sources/SmithyJSON/Document+JSONUtils.swift +++ b/Sources/SmithyJSON/Document+JSONUtils.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import func CoreFoundation.CFGetTypeID import func CoreFoundation.CFBooleanGetTypeID +import func CoreFoundation.CFGetTypeID import struct Foundation.Data import struct Foundation.Date import class Foundation.DateFormatter diff --git a/Sources/SmithyJSON/Reader/Reader+JSONDeserialization.swift b/Sources/SmithyJSON/Reader/Reader+JSONDeserialization.swift index 42c660101..8f44ce0be 100644 --- a/Sources/SmithyJSON/Reader/Reader+JSONDeserialization.swift +++ b/Sources/SmithyJSON/Reader/Reader+JSONDeserialization.swift @@ -6,8 +6,8 @@ // import struct Foundation.Data -import class Foundation.NSError import class Foundation.JSONSerialization +import class Foundation.NSError import class Foundation.NSNull extension Reader { diff --git a/Sources/SmithyJSON/Reader/Reader.swift b/Sources/SmithyJSON/Reader/Reader.swift index 9836bd14b..9dc375cb2 100644 --- a/Sources/SmithyJSON/Reader/Reader.swift +++ b/Sources/SmithyJSON/Reader/Reader.swift @@ -5,20 +5,20 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyReader -import protocol Smithy.SmithyDocument -import struct Smithy.Document -import typealias SmithyReadWrite.ReadingClosure -import enum SmithyReadWrite.ReaderError -@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat -@_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter +import func CoreFoundation.CFBooleanGetTypeID +import func CoreFoundation.CFGetTypeID import struct Foundation.Data import struct Foundation.Date +import class Foundation.NSDecimalNumber import class Foundation.NSNull import class Foundation.NSNumber -import class Foundation.NSDecimalNumber -import func CoreFoundation.CFGetTypeID -import func CoreFoundation.CFBooleanGetTypeID +import struct Smithy.Document +import protocol Smithy.SmithyDocument +import enum SmithyReadWrite.ReaderError +import typealias SmithyReadWrite.ReadingClosure +@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyReader +@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat +@_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter @_spi(SmithyReadWrite) public final class Reader: SmithyReader { diff --git a/Sources/SmithyJSON/Writer/Writer.swift b/Sources/SmithyJSON/Writer/Writer.swift index b76f7c4f4..10b0c13dd 100644 --- a/Sources/SmithyJSON/Writer/Writer.swift +++ b/Sources/SmithyJSON/Writer/Writer.swift @@ -5,14 +5,14 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter -@_spi(SmithyDocumentImpl) import protocol Smithy.SmithyDocument -import enum Smithy.DocumentError -@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat -@_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter import struct Foundation.Data import struct Foundation.Date import class Foundation.NSNumber +import enum Smithy.DocumentError +@_spi(SmithyDocumentImpl) import protocol Smithy.SmithyDocument +@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter +@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat +@_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter @_spi(SmithyReadWrite) public final class Writer: SmithyWriter { diff --git a/Sources/SmithyReadWrite/SmithyReader.swift b/Sources/SmithyReadWrite/SmithyReader.swift index 7fc95afe1..47819f431 100644 --- a/Sources/SmithyReadWrite/SmithyReader.swift +++ b/Sources/SmithyReadWrite/SmithyReader.swift @@ -7,8 +7,8 @@ import struct Foundation.Data import struct Foundation.Date -@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat import struct Smithy.Document +@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat @_spi(SmithyReadWrite) public protocol SmithyReader: AnyObject { diff --git a/Sources/SmithyReadWrite/SmithyWriter.swift b/Sources/SmithyReadWrite/SmithyWriter.swift index e27d4132f..b6cbf71c7 100644 --- a/Sources/SmithyReadWrite/SmithyWriter.swift +++ b/Sources/SmithyReadWrite/SmithyWriter.swift @@ -7,9 +7,9 @@ import struct Foundation.Data import struct Foundation.Date -@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat import enum Smithy.ByteStream import protocol Smithy.SmithyDocument +@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat @_spi(SmithyReadWrite) public protocol SmithyWriter: AnyObject { diff --git a/Sources/SmithyReadWrite/WritingClosure.swift b/Sources/SmithyReadWrite/WritingClosure.swift index fcc3fe20a..98187785a 100644 --- a/Sources/SmithyReadWrite/WritingClosure.swift +++ b/Sources/SmithyReadWrite/WritingClosure.swift @@ -7,8 +7,8 @@ import struct Foundation.Data import struct Foundation.Date -@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat import protocol Smithy.SmithyDocument +@_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat @_spi(SmithyReadWrite) public typealias WritingClosure = (T, Writer) throws -> Void diff --git a/Sources/SmithyRetries/DefaultRetryStrategy/ClientSideRateLimiter.swift b/Sources/SmithyRetries/DefaultRetryStrategy/ClientSideRateLimiter.swift index e742e181a..237a88aec 100644 --- a/Sources/SmithyRetries/DefaultRetryStrategy/ClientSideRateLimiter.swift +++ b/Sources/SmithyRetries/DefaultRetryStrategy/ClientSideRateLimiter.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct Foundation.TimeInterval import struct Foundation.Date import func Foundation.pow +import struct Foundation.TimeInterval actor ClientSideRateLimiter { diff --git a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift index fea3e08bc..09107cc5b 100644 --- a/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift +++ b/Sources/SmithyRetries/DefaultRetryStrategy/DefaultRetryStrategy.swift @@ -6,10 +6,10 @@ // import struct Foundation.TimeInterval +import enum SmithyRetriesAPI.RetryError +import struct SmithyRetriesAPI.RetryErrorInfo import protocol SmithyRetriesAPI.RetryStrategy import struct SmithyRetriesAPI.RetryStrategyOptions -import struct SmithyRetriesAPI.RetryErrorInfo -import enum SmithyRetriesAPI.RetryError public struct DefaultRetryStrategy: RetryStrategy { public typealias Token = DefaultRetryToken diff --git a/Sources/SmithyStreams/FileStream.swift b/Sources/SmithyStreams/FileStream.swift index c9431fadf..a5646ac7c 100644 --- a/Sources/SmithyStreams/FileStream.swift +++ b/Sources/SmithyStreams/FileStream.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import struct Foundation.Data import class Foundation.FileHandle import class Foundation.NSRecursiveLock -import struct Foundation.Data import protocol Smithy.Stream /// A `Stream` that wraps a `FileHandle` for reading the file. diff --git a/Sources/SmithyStreams/StreamableHttpBody.swift b/Sources/SmithyStreams/StreamableHttpBody.swift index 434312903..e6f80bbed 100644 --- a/Sources/SmithyStreams/StreamableHttpBody.swift +++ b/Sources/SmithyStreams/StreamableHttpBody.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // -import struct Foundation.Data import AwsCommonRuntimeKit -import struct Smithy.SwiftLogger -import protocol Smithy.Stream +import struct Foundation.Data import enum Smithy.ByteStream +import protocol Smithy.Stream import enum Smithy.StreamError +import struct Smithy.SwiftLogger /// A class that implements the `IStreamable` protocol for `ByteStream`. /// It acts as a bridge between AWS SDK and CRT. diff --git a/Sources/SmithyTimestamps/DateFormatters.swift b/Sources/SmithyTimestamps/DateFormatters.swift index e31f666f8..e422f8b0b 100644 --- a/Sources/SmithyTimestamps/DateFormatters.swift +++ b/Sources/SmithyTimestamps/DateFormatters.swift @@ -3,10 +3,10 @@ * SPDX-License-Identifier: Apache-2.0. */ +import struct Foundation.Date import class Foundation.DateFormatter -import struct Foundation.TimeZone import struct Foundation.Locale -import struct Foundation.Date +import struct Foundation.TimeZone public typealias DateFormatter = Foundation.DateFormatter diff --git a/Sources/SmithyTimestamps/TimestampSerdeUtils.swift b/Sources/SmithyTimestamps/TimestampSerdeUtils.swift index 26310cae2..2d5a249f6 100644 --- a/Sources/SmithyTimestamps/TimestampSerdeUtils.swift +++ b/Sources/SmithyTimestamps/TimestampSerdeUtils.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import func Foundation.floor import struct Foundation.Date +import func Foundation.floor /// Custom timestamp serialization formats /// https://smithy.io/2.0/spec/protocol-traits.html#smithy-api-timestampformat-trait diff --git a/Sources/SmithyXML/Reader/Reader+libxml2.swift b/Sources/SmithyXML/Reader/Reader+libxml2.swift index f8c8f110d..3ae5c35f2 100644 --- a/Sources/SmithyXML/Reader/Reader+libxml2.swift +++ b/Sources/SmithyXML/Reader/Reader+libxml2.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -@preconcurrency import libxml2 import struct Foundation.Data +@preconcurrency import libxml2 extension Reader { diff --git a/Sources/SmithyXML/Reader/Reader.swift b/Sources/SmithyXML/Reader/Reader.swift index 85d3f3f73..88189cf8a 100644 --- a/Sources/SmithyXML/Reader/Reader.swift +++ b/Sources/SmithyXML/Reader/Reader.swift @@ -5,11 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyReader +import struct Foundation.Data +import struct Foundation.Date import struct Smithy.Document @_spi(SmithyReadWrite) import typealias SmithyReadWrite.ReadingClosure -import struct Foundation.Date -import struct Foundation.Data +@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyReader @_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat @_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter diff --git a/Sources/SmithyXML/Writer/Writer+libxml2.swift b/Sources/SmithyXML/Writer/Writer+libxml2.swift index 65b6530c4..c9fc8e100 100644 --- a/Sources/SmithyXML/Writer/Writer+libxml2.swift +++ b/Sources/SmithyXML/Writer/Writer+libxml2.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -@preconcurrency import libxml2 import struct Foundation.Data +@preconcurrency import libxml2 /// Extends Writer to copy its tree into libxml2, then write the tree to XML data. extension Writer { diff --git a/Sources/SmithyXML/Writer/Writer.swift b/Sources/SmithyXML/Writer/Writer.swift index 867cfb538..ee58bb391 100644 --- a/Sources/SmithyXML/Writer/Writer.swift +++ b/Sources/SmithyXML/Writer/Writer.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter -import protocol Smithy.SmithyDocument -import struct Foundation.Date import struct Foundation.Data +import struct Foundation.Date +import protocol Smithy.SmithyDocument +@_spi(SmithyReadWrite) import protocol SmithyReadWrite.SmithyWriter @_spi(SmithyReadWrite) import typealias SmithyReadWrite.WritingClosure @_spi(SmithyTimestamps) import enum SmithyTimestamps.TimestampFormat @_spi(SmithyTimestamps) import struct SmithyTimestamps.TimestampFormatter From f4fcab3cac32049848055015fcfabda7fee8988c Mon Sep 17 00:00:00 2001 From: AWS SDK Swift Automation Date: Fri, 7 Nov 2025 19:16:18 +0000 Subject: [PATCH 9/9] chore: Updates version to 0.170.0 --- Package.version | 2 +- Package.version.next | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.version b/Package.version index 306cba6c0..1d80af247 100644 --- a/Package.version +++ b/Package.version @@ -1 +1 @@ -0.169.0 \ No newline at end of file +0.170.0 \ No newline at end of file diff --git a/Package.version.next b/Package.version.next index 1d80af247..5d1fe6b31 100644 --- a/Package.version.next +++ b/Package.version.next @@ -1 +1 @@ -0.170.0 \ No newline at end of file +0.171.0 \ No newline at end of file