-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: codegen visitor filtering bug #1049
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,15 +25,15 @@ import software.amazon.smithy.model.shapes.ShapeId | |
* Register support for the `aws.auth#sigv4a` auth scheme. | ||
*/ | ||
class SigV4AsymmetricAuthSchemeIntegration : KotlinIntegration { | ||
// Needs to happen after the `SigV4AsymmetricTraitCustomization` (-60). | ||
override val order: Byte = -50 | ||
|
||
// Needs to be true due to the way integrations are filtered out before application and sigV4a customization. | ||
// See 'CodegenVisitor' & 'SigV4AsymmetricTraitCustomization' | ||
override fun enabledForService(model: Model, settings: KotlinSettings): Boolean = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: There is one more of these hardcoded There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that one is in |
||
override fun enabledForService(model: Model, settings: KotlinSettings): Boolean = | ||
ServiceIndex | ||
.of(model) | ||
.getAuthSchemes(settings.service) | ||
.values | ||
.any { it.javaClass == SigV4ATrait::class.java } | ||
|
||
override fun authSchemes(ctx: ProtocolGenerator.GenerationContext): List<AuthSchemeHandler> = | ||
if (modelHasSigV4aTrait(ctx)) listOf(SigV4AsymmetricAuthSchemeHandler()) else emptyList() | ||
listOf(SigV4AsymmetricAuthSchemeHandler()) | ||
} | ||
|
||
private class SigV4AsymmetricAuthSchemeHandler : AuthSchemeHandler { | ||
|
@@ -69,10 +69,3 @@ private class SigV4AsymmetricAuthSchemeHandler : AuthSchemeHandler { | |
writer.write("#T(#T, #S)", RuntimeTypes.Auth.HttpAuthAws.SigV4AsymmetricAuthScheme, RuntimeTypes.Auth.Signing.AwsSigningStandard.DefaultAwsSigner, signingService) | ||
} | ||
} | ||
|
||
internal fun modelHasSigV4aTrait(ctx: ProtocolGenerator.GenerationContext): Boolean = | ||
ServiceIndex | ||
.of(ctx.model) | ||
.getAuthSchemes(ctx.service) | ||
.values | ||
.any { it.javaClass == SigV4ATrait::class.java } |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
design suggestion: instead of making this a
MutableList
, it might be better to haveconfiguredIntegrations
andenabledIntegrations
(configuredIntegrations - disabledIntegrations
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example: