Skip to content

Conversation

@0marperez
Copy link
Contributor

Issue #

N/A

Description of changes

Refactored protocols and protocol generator supplier so generic client implementations can be generated

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@0marperez 0marperez marked this pull request as ready for review December 15, 2025 16:09
@0marperez 0marperez requested a review from a team as a code owner December 15, 2025 16:09
Copy link
Contributor

@lauzadis lauzadis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything in this PR that deals with default implementations, did we only have to relocate the protocols for this to work?

{
"id": "ece99a81-4736-43df-a20e-9a367e36370b",
"type": "feature",
"description": "Started generating default implementations for generic clients"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* SPDX-License-Identifier: Apache-2.0
*/
package software.amazon.smithy.kotlin.codegen.aws.protocols.core
package software.amazon.smithy.kotlin.codegen.protocols.core
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this and other packages change?

Copy link
Contributor Author

@0marperez 0marperez Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we refactored the protocols core and others from smithy-aws-kotlin-codegen into smithy-kotlin-codegen

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify why we need to move the AWS protocols from smithy-aws-kotlin-codegen to smithy-kotlin-codegen? IIRC this was an intentional split to separate AWS protocols from generic Smithy ones (CBOR). Customers could still add a dependency on the smithy-aws-kotlin-codegen module if they want to use an AWS protocol

import software.amazon.smithy.model.shapes.ServiceShape
import software.amazon.smithy.model.shapes.ShapeId
import kotlin.collections.plus

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this import necessary? Same below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added by Intellij, it's not necessary

@0marperez
Copy link
Contributor Author

0marperez commented Dec 15, 2025

@lauzadis

I don't see anything in this PR that deals with default implementations, did we only have to relocate the protocols for this to work?

We also had to refactor/relocate SdkProtocolGeneratorSupplier -> ProtocolGeneratorSupplier

Comment on lines 5 to 11
package software.amazon.smithy.kotlin.codegen.aws.protocols.core

import software.amazon.smithy.codegen.core.Symbol
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonHttpBindingResolver
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
import software.amazon.smithy.kotlin.codegen.model.expectShape
import software.amazon.smithy.kotlin.codegen.protocols.core.AwsHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.protocols.json.AwsJsonHttpBindingResolver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness: Unit test classes should be in the same package and module as the units they test.

Comment on lines 233 to 240
use aws.protocols#awsJson1_0
use aws.protocols#restJson1
use smithy.rules#operationContextParams
use smithy.rules#endpointRuleSet
use aws.api#service
@awsJson1_0
@restJson1
@service(sdkId: "UnionOperationTest")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why did we change the subject protocol for this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the new code generation changes, the function used in these tests couldn't resolve awsJson1_0 in it's dependencies

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to update the dependencies somewhere so it can resolve awsJson1_0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants