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

feat(smithydotnet): add dependency error from localservice trait #288

Merged
merged 8 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions TestModels/Dependencies/Model/Dependencies.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace simple.dependencies
use simple.resources#SimpleResources
use simple.constraints#SimpleConstraints
use simple.extendable.resources#SimpleExtendableResources
use simple.errors#SimpleErrors
//use simple.errors#SimpleErrors
josecorella marked this conversation as resolved.
Show resolved Hide resolved

@aws.polymorph#localService(
sdkId: "SimpleDependencies",
Expand All @@ -14,7 +14,7 @@ use simple.errors#SimpleErrors
SimpleResources,
SimpleConstraints,
SimpleExtendableResources,
SimpleErrors
//SimpleErrors
josecorella marked this conversation as resolved.
Show resolved Hide resolved
]
)
service SimpleDependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,17 @@ protected TokenTree errorFromDanyBody(final TreeSet<StructureShape> errorShapes)
Set<String> dependentNamespaces = ModelUtils.findAllDependentNamespaces(
new HashSet<ShapeId>(Collections.singleton(localServiceTrait.getConfigId())), model);

if (localServiceTrait.getDependencies() != null) {
localServiceTrait.getDependencies().stream()
.map(model::expectShape)
.map(Shape::asServiceShape)
.filter(Optional::isPresent)
.map(Optional::get)
.forEach( serviceShape ->
dependentNamespaces.add(serviceShape.getId().getNamespace())
);
}

if (dependentNamespaces.size() > 0) {
Set<TokenTree> cases = new HashSet<>();
for (String dependentNamespace : dependentNamespaces) {
Expand Down
Loading