smithy
smithy copied to clipboard
Feature request: includeFor integration
It is useful to have an integration only apply for a specific service.
We have this in Ruby like so: https://github.com/smithy-lang/smithy-ruby/blob/779dd349560371b525758a45e83e21673e67753a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubyIntegration.java#L45
Kotlin also has this: https://github.com/smithy-lang/smithy-kotlin/blob/main/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/integration/KotlinIntegration.kt#L60
I'm unsure of the recommended method arguments for this, but the need is for integrations to only apply in some cases, such as s3, or if a service has a particular trait. Such a method (I propose includeFor) should run before preprocessModel and other integration hooks - it should be the very first thing checked IMO.
Currently we run into issues using preprocessModel, which runs before our hook to includeFor, so each preprocessModel method has to check and return the model if certain shapes aren't present or if the service model isn't what the integration is targeting.