Skip to content

Use Array shorthand - Type[] instead of Array<Type> #168

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

Merged
merged 5 commits into from
May 1, 2020
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 @@ -124,7 +124,7 @@ public Symbol booleanShape(BooleanShape shape) {
@Override
public Symbol listShape(ListShape shape) {
Symbol reference = toSymbol(shape.getMember());
return createSymbolBuilder(shape, format("Array<%s>", reference.getName()), null)
return createSymbolBuilder(shape, format("(%s)[]", reference.getName()), null)
.addReference(reference)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public final Void documentShape(DocumentShape shape) {
* const deserializeAws_restJson1_1ParameterList = (
* output: any,
* context: SerdeContext
* ): Array<Parameter> => {
* ): Parameter[] => {
* return (output || []).map((entry: any) =>
* deserializeAws_restJson1_1Parameter(entry, context)
* );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public final Void documentShape(DocumentShape shape) {
*
* <pre>{@code
* const serializeAws_restJson1_1ParametersList = (
* input: Array<Parameter>,
* input: Parameter[],
* context: SerdeContext
* ): any => {
* return (input || []).map(entry =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void escapesRecursiveSymbols() {
SymbolProvider provider = TypeScriptCodegenPlugin.createSymbolProvider(model);
Symbol listSymbol = provider.toSymbol(list);

assertThat(listSymbol.getName(), equalTo("Array<_Record>"));
assertThat(listSymbol.getName(), equalTo("(_Record)[]"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private static final class MockProvider implements SymbolProvider {
.namespace("com.smithy.example", "/")
.build();
private Symbol collectionMock = Symbol.builder()
.name("Array<Foo>")
.name("Foo[]")
.namespace("com.smithy.example", "/")
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static final class MockProvider implements SymbolProvider {
.namespace("com.smithy.example", "/")
.build();
private Symbol collectionMock = Symbol.builder()
.name("Array<Foo>")
.name("Foo[]")
.namespace("com.smithy.example", "/")
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void buildsSerFunctionNameForCollection() {
.member(member)
.build();
Symbol symbol = Symbol.builder()
.name("Array<Foo>")
.name("Foo[]")
.namespace("com.smithy.example", ".")
.putProperty("shape", list)
.build();
Expand Down Expand Up @@ -72,7 +72,7 @@ public void buildsDeserFunctionNameForCollection() {
.member(member)
.build();
Symbol symbol = Symbol.builder()
.name("Array<Foo>")
.name("Foo[]")
.namespace("com.smithy.example", ".")
.putProperty("shape", list)
.build();
Expand Down