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: Don't assume that all service bindings existed before #2405

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,27 @@ public List<ValidationEvent> evaluate(Differences differences) {
}
// Validate Operation effective auth schemes
for (ServiceShape newServiceShape : newOperationServiceBindings) {
ServiceShape oldServiceShape = oldModel.expectShape(newServiceShape.getId(), ServiceShape.class);
OperationShape oldOperationShape = change.getOldShape();
List<ShapeId> oldAuthSchemes = oldServiceIndex
.getEffectiveAuthSchemes(oldServiceShape, oldOperationShape)
.keySet()
.stream()
.collect(Collectors.toList());
List<ShapeId> newAuthSchemes = newServiceIndex
.getEffectiveAuthSchemes(newServiceShape, newOperationShape)
.keySet()
.stream()
.collect(Collectors.toList());
validateMigration(
newOperationShape,
oldAuthSchemes,
newAuthSchemes,
events);
oldModel.getShape(newServiceShape.getId())
.filter(Shape::isServiceShape)
.map(s -> (ServiceShape) s)
.ifPresent(oldServiceShape -> {
OperationShape oldOperationShape = change.getOldShape();
List<ShapeId> oldAuthSchemes = oldServiceIndex
.getEffectiveAuthSchemes(oldServiceShape, oldOperationShape)
.keySet()
.stream()
.collect(Collectors.toList());
List<ShapeId> newAuthSchemes = newServiceIndex
.getEffectiveAuthSchemes(newServiceShape, newOperationShape)
.keySet()
.stream()
.collect(Collectors.toList());
validateMigration(
newOperationShape,
oldAuthSchemes,
newAuthSchemes,
events);
});
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$version: "2.0"

metadata suppressions = [
{
id: "ModifiedTrait.Update.smithy.api#auth"
namespace: "ns.foo"
}
]

namespace ns.foo

@auth([])
@httpBearerAuth
service Service {
operations: [
Operation
]
}

@auth([])
operation Operation {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$version: "2.0"

metadata suppressions = [
{
id: "ModifiedTrait.Update.smithy.api#auth"
namespace: "ns.foo"
}
]

namespace ns.foo

@auth([httpBearerAuth])
@httpBearerAuth
service Service {
operations: [
Operation
]
}

@auth([httpBearerAuth])
@httpBearerAuth
service NewService {
operations: [
Operation
]
}


@auth([httpBearerAuth])
operation Operation {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[NOTE] ns.foo#NewService: Added service `ns.foo#NewService` | AddedShape
Loading