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

Enforce private on traits #1406

Merged
merged 2 commits into from
Sep 20, 2022
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 @@ -32,7 +32,7 @@ structure awsJson1_1 with [HttpConfiguration] {}

/// Contains HTTP protocol configuration for HTTP-based protocols.
@private
@mixin
@mixin(localTraits: [private])
structure HttpConfiguration {
/// The priority ordered list of supported HTTP protocol versions.
http: StringList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class PrivateAccessValidator extends AbstractValidator {

@Override
public List<ValidationEvent> validate(Model model) {
NeighborProvider provider = NeighborProviderIndex.of(model).getReverseProvider();
NeighborProvider provider = NeighborProviderIndex.of(model).getReverseProviderWithTraitRelationships();

List<ValidationEvent> events = new ArrayList<>();
for (Shape privateShape : model.getShapesWithTrait(PrivateTrait.class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
[ERROR] smithy.example#InvalidOperation: This shape has an invalid output relationship that targets a private shape, `smithy.private#InvalidOperationOutput`, in another namespace. | PrivateAccess
[ERROR] smithy.example#InvalidService: This shape has an invalid operation relationship that targets a private shape, `smithy.private#PrivateOperation`, in another namespace. | PrivateAccess
[ERROR] smithy.example#InvalidStructure$invalid: This shape has an invalid member_target relationship that targets a private shape, `smithy.private#PrivateString`, in another namespace. | PrivateAccess
[ERROR] smithy.example#InvalidTraitApplication: This shape has an invalid trait relationship that targets a private shape, `smithy.private#privateTrait`, in another namespace. | PrivateAccess
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@
}
]
},
"smithy.example#InvalidTraitApplication": {
"type": "structure",
"members": {},
"traits": {
"smithy.private#privateTrait": {}
}
},
"smithy.private#privateTrait": {
"type": "structure",
"traits": {
"smithy.api#trait": {},
"smithy.api#private": {}
}
},
"smithy.private#InvalidOperationInput": {
"type": "structure",
"members": {
Expand All @@ -64,6 +78,9 @@
},
"map": {
"target": "smithy.example#InvalidMap"
},
"traitApplication": {
"target": "smithy.example#InvalidTraitApplication"
}
},
"traits": {
Expand All @@ -85,6 +102,9 @@
},
"map": {
"target": "smithy.example#InvalidMap"
},
"traitApplication": {
"target": "smithy.example#InvalidTraitApplication"
}
},
"traits": {
Expand Down