Skip to content

ensure consistent ordering #78

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 2 commits into from
Jan 7, 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 @@ -254,7 +254,8 @@ public Void serviceShape(ServiceShape shape) {

// Generate each operation for the service.
TopDownIndex topDownIndex = model.getKnowledge(TopDownIndex.class);
for (OperationShape operation : topDownIndex.getContainedOperations(service)) {
Set<OperationShape> containedOperations = new TreeSet<>(topDownIndex.getContainedOperations(service));
for (OperationShape operation : containedOperations) {
writers.useShapeWriter(operation, commandWriter -> new CommandGenerator(
settings, model, operation, symbolProvider, commandWriter,
runtimePlugins, protocolGenerator, applicationProtocol).run());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package software.amazon.smithy.typescript.codegen;

import java.util.Set;
import java.util.TreeSet;
import software.amazon.smithy.build.FileManifest;
import software.amazon.smithy.codegen.core.Symbol;
import software.amazon.smithy.codegen.core.SymbolProvider;
Expand Down Expand Up @@ -49,7 +51,8 @@ static void writeIndex(

// write export statements for each command in /commands directory
TopDownIndex topDownIndex = model.getKnowledge(TopDownIndex.class);
for (OperationShape operation : topDownIndex.getContainedOperations(service)) {
Set<OperationShape> containedOperations = new TreeSet<>(topDownIndex.getContainedOperations(service));
for (OperationShape operation : containedOperations) {
writer.write("export * from \"./commands/" + symbolProvider.toSymbol(operation).getName() + "\";");
}
fileManifest.writeFile("index.ts", writer.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package software.amazon.smithy.typescript.codegen;

import java.util.Set;
import java.util.TreeSet;
import software.amazon.smithy.codegen.core.Symbol;
import software.amazon.smithy.codegen.core.SymbolProvider;
import software.amazon.smithy.model.Model;
Expand Down Expand Up @@ -67,7 +69,8 @@ public void run() {
// Generate the client and extend from the modular client.
writer.writeShapeDocs(service);
writer.openBlock("export class $L extends $T {", "}", nonModularName, serviceSymbol, () -> {
for (OperationShape operation : topDownIndex.getContainedOperations(service)) {
Set<OperationShape> containedOperations = new TreeSet<>(topDownIndex.getContainedOperations(service));
for (OperationShape operation : containedOperations) {
Symbol operationSymbol = symbolProvider.toSymbol(operation);
Symbol input = operationSymbol.expectProperty("inputType", Symbol.class);
Symbol output = operationSymbol.expectProperty("outputType", Symbol.class);
Expand Down