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): use TopDownIndex::getContainedOperations() for operation iterations #1109

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

syall
Copy link
Contributor

@syall syall commented Dec 12, 2023

Issue #, if available:

N/A.

Description of changes:

Use TopDownIndex::getContainedOperations() for operation iterations.

If one or more of the packages in the /packages directory has been modified, be sure yarn changeset add has been run and its output has
been committed and included in this pull request. See CONTRIBUTING.md.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@syall syall marked this pull request as ready for review December 12, 2023 15:25
@syall syall requested review from a team as code owners December 12, 2023 15:25
@syall syall requested a review from sugmanue December 12, 2023 15:25
) {
Map<ShapeId, HttpAuthScheme> effectiveAuthSchemes = new TreeMap<>();
var serviceEffectiveAuthSchemes =
serviceIndex.getEffectiveAuthSchemes(serviceShape, AuthSchemeMode.NO_AUTH_AWARE);
for (ShapeId shapeId : serviceEffectiveAuthSchemes.keySet()) {
effectiveAuthSchemes.put(shapeId, authIndex.getHttpAuthScheme(shapeId));
}
for (var operation : serviceShape.getAllOperations()) {
for (var operation : topDownIndex.getContainedOperations(serviceShape)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there anything going in place to warn that serviceShape.getAllOperations() is not how to get service operations? 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically the javadoc for ServiceShape::getAllOperations() mentions that it doesn't contain everything and references TopDownIndex::getContainedOperations(), unfortunately there isn't a way to enforce it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Albeit there is documentation on smithy.io that documents using the TopDownIndex.

@syall syall merged commit 3864faa into smithy-lang:main Dec 12, 2023
7 checks passed
@syall syall deleted the use-topdownindex-contained-operations branch December 12, 2023 15:40
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.

2 participants