Skip to content
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

Merged
merged 2 commits into from
Mar 8, 2024
Merged

fix: codegen visitor filtering bug #1049

merged 2 commits into from
Mar 8, 2024

Conversation

0marperez
Copy link
Contributor

Issue #

N/A

The CodegenVisitor was filtering out integrations that would otherwise not be because of the filtering didn't take into account model pre-processing changes that would happen

Description of changes

Filtering was updated so Integrations take into account previous model pre-processing

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

@0marperez 0marperez added the no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly. label Mar 7, 2024
@0marperez 0marperez requested a review from a team as a code owner March 7, 2024 22:08
Copy link

sonarqubecloud bot commented Mar 7, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

.sortedBy(KotlinIntegration::order)
.toMutableList()
Copy link
Contributor

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 have configuredIntegrations and enabledIntegrations (configuredIntegrations - disabledIntegrations)

Copy link
Contributor

Choose a reason for hiding this comment

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

example:

        configuredIntegrations = ServiceLoader.load(KotlinIntegration::class.java, classLoader)
...
        val enabledIntegrations = configuredIntegrations.mapNotNull { integration ->
            if (integration.enabledForService(resolvedModel, settings)) {
                println("Executing KotlinIntegration: ${integration.javaClass.name}")
                resolvedModel = integration.preprocessModel(resolvedModel, settings)
                integration
            } else {
                null
            }
        }


// 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
Copy link
Contributor

Choose a reason for hiding this comment

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

note: There is one more of these hardcoded true in UnsupportedSigningAlgorithmIntegration, do you plan to change that one separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that one is in aws-sdk-kotlin. The change is in a pull request here: awslabs/aws-sdk-kotlin#1245

@0marperez 0marperez merged commit c836ace into main Mar 8, 2024
13 checks passed
@0marperez 0marperez deleted the sigv4a-signer-exception branch March 11, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants