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

Add help text to ResourceOperationInputOutput event #2489

Merged
merged 1 commit into from
Dec 19, 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 @@ -33,6 +33,9 @@
import software.amazon.smithy.model.shapes.ResourceShape;
import software.amazon.smithy.model.shapes.Shape;
import software.amazon.smithy.model.shapes.ShapeId;
import software.amazon.smithy.model.traits.NotPropertyTrait;
import software.amazon.smithy.model.traits.PropertyTrait;
import software.amazon.smithy.model.traits.ResourceIdentifierTrait;
import software.amazon.smithy.model.validation.AbstractValidator;
import software.amazon.smithy.model.validation.ValidationEvent;

Expand Down Expand Up @@ -214,8 +217,10 @@ private void validateMember(
resource.getId(), propertyName)));
}
} else if (!identifierMembers.contains(member.getMemberName())) {
events.add(error(member, String.format("Member `%s` does not target a property or identifier"
+ " for resource `%s`", member.getMemberName(), resource.getId().toString())));
events.add(error(member, String.format("Member `%s` does not target a property or identifier for resource "
+ "`%s`. If it is an identifier, apply the `%s` trait. If it is a property, apply the `%s` trait. "
+ "If it is neither, apply the `%s` trait.", member.getMemberName(), resource.getId().toString(),
ResourceIdentifierTrait.ID, PropertyTrait.ID, NotPropertyTrait.ID)));
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[ERROR] com.example#CreateResourceOutput$id: Member `id` does not target a property or identifier for resource `com.example#Resource1` | ResourceOperationInputOutput
[ERROR] com.example#CreateResourceOutput$id: Member `id` does not target a property or identifier for resource `com.example#Resource1`. If it is an identifier, apply the `smithy.api#resourceIdentifier` trait. If it is a property, apply the `smithy.api#property` trait. If it is neither, apply the `smithy.api#notProperty` trait. | ResourceOperationInputOutput
Loading