Skip to content
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 @@ -158,6 +158,7 @@ private void renderErrorStructure() {

writer.openBlock("export interface $L extends $L {", symbol.getName(), extendsFrom);
writer.write("__type: $S;", shape.getId().getName());
writer.write("name: $S;", shape.getId().getName());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were just special casing exceptions. Why is this needed on all structures? Why would we need this and __type?

Copy link
Contributor Author

@kstich kstich Jan 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the code for exception structures renderErrorStructure, as to the why we have both I think that's #92.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. This needs to be addressed in a followup PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue created for removing __type #96

writer.write("$$fault: $S;", errorTrait.getValue());
StructuredMemberWriter config = new StructuredMemberWriter(
model, symbolProvider, shape.getAllMembers().values());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void properlyGeneratesEmptyMessageMemberOfException() {
testErrorStructureCodegen("error-test-empty.smithy",
"export interface Err extends _smithy.SmithyException, $MetadataBearer {\n"
+ " __type: \"Err\";\n"
+ " name: \"Err\";\n"
+ " $fault: \"client\";\n"
+ "}");
}
Expand All @@ -28,6 +29,7 @@ public void properlyGeneratesOptionalMessageMemberOfException() {
testErrorStructureCodegen("error-test-optional-message.smithy",
"export interface Err extends _smithy.SmithyException, $MetadataBearer {\n"
+ " __type: \"Err\";\n"
+ " name: \"Err\";\n"
+ " $fault: \"client\";\n"
+ " message?: string;\n"
+ "}");
Expand All @@ -38,6 +40,7 @@ public void properlyGeneratesRequiredMessageMemberOfException() {
testErrorStructureCodegen("error-test-required-message.smithy",
"export interface Err extends _smithy.SmithyException, $MetadataBearer {\n"
+ " __type: \"Err\";\n"
+ " name: \"Err\";\n"
+ " $fault: \"client\";\n"
+ " message: string | undefined;\n"
+ "}");
Expand Down