Skip to content

Commit 52e9bd3

Browse files
committed
test(codegen): add test case for multiple visible services in model
1 parent ebf18ff commit 52e9bd3

File tree

5 files changed

+46
-8
lines changed

5 files changed

+46
-8
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sync:
88
git fetch --all
99

1010
generate-protocol-tests:
11+
rm -rf ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen
1112
./gradlew :smithy-typescript-protocol-test-codegen:build
1213
rm -rf ./private/smithy-rpcv2-cbor
1314
rm -rf ./private/smithy-rpcv2-cbor-schema

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/knowledge/ServiceClosure.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,11 @@ private void scan(Collection<Shape> shapes) {
273273
existsAsSchema.add(operation);
274274
}
275275
case SERVICE -> {
276-
// ServiceShape serviceShape = (ServiceShape) shape;
277-
// serviceShape.getErrorsSet().forEach(errorShapeId -> {
278-
// Shape errorShape = model.expectShape(errorShapeId);
279-
// scan(errorShape);
280-
// });
276+
ServiceShape serviceShape = (ServiceShape) shape;
277+
serviceShape.getErrorsSet().forEach(errorShapeId -> {
278+
Shape errorShape = model.expectShape(errorShapeId);
279+
scan(errorShape);
280+
});
281281
}
282282
case BYTE, INT_ENUM, SHORT, INTEGER, LONG, FLOAT, DOUBLE, BIG_INTEGER, BIG_DECIMAL, BOOLEAN, STRING,
283283
TIMESTAMP, DOCUMENT, ENUM, BLOB -> {

smithy-typescript-protocol-test-codegen/model/my-local-model/main.smithy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@ structure UnusedServiceLinkedError {}
129129

130130
@error("client")
131131
@httpError(400)
132-
structure CompletelyUnlinkedError {}
132+
structure CompletelyUnlinkedError {}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
$version: "2.0"
2+
3+
namespace org.xyz.secondary
4+
5+
use smithy.protocols#rpcv2Cbor
6+
7+
@rpcv2Cbor
8+
@documentation("a second service in the same model, unused.")
9+
service TertiaryService {
10+
version: "1.0"
11+
operations: [
12+
TertiaryUnusedOperation
13+
]
14+
errors: [
15+
TertiaryUnusedServiceLinkedError
16+
]
17+
}
18+
19+
operation TertiaryUnusedOperation {
20+
input: Unit
21+
output: Unit
22+
errors: [
23+
TertiaryUnusedServiceOperationLinkedError
24+
]
25+
}
26+
27+
@error("client")
28+
@httpError(400)
29+
structure TertiaryUnusedServiceOperationLinkedError {}
30+
31+
@error("client")
32+
@httpError(400)
33+
structure TertiaryUnusedServiceLinkedError {}
34+
35+
@error("client")
36+
@httpError(400)
37+
structure TertiaryCompletelyUnlinkedError {}

smithy-typescript-protocol-test-codegen/smithy-build.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
{
6363
"name": "includeServices",
6464
"args": {
65-
"services": ["org.xyz.v1#XYZService"]
65+
"services": ["org.xyz.v1#XYZService", "org.xyz.v1#UnusedService", "org.xyz.secondary#TertiaryService"]
6666
}
6767
}
6868
],
@@ -83,7 +83,7 @@
8383
{
8484
"name": "includeServices",
8585
"args": {
86-
"services": ["org.xyz.v1#XYZService"]
86+
"services": ["org.xyz.v1#XYZService", "org.xyz.v1#UnusedService", "org.xyz.secondary#TertiaryService"]
8787
}
8888
}
8989
],

0 commit comments

Comments
 (0)