Skip to content

Commit

Permalink
feat(type-safe-api): replace openapi-generator for typescript rest ap…
Browse files Browse the repository at this point in the history
…i code generation (#831)

This change replaces the java openapi-generator CLI tool with our own code generation tool, which
produces equivalent code. This removes the dependency on Java for the TypeScript REST API projects,
as well as improving the speed of code generation by avoiding package installation steps and the
multiple passes of openapi codegen used to work around limitations of the tool.

Note that this change fixes #789, which means that those hitting the edge case described in the
issue may experience a breaking change.

Generated code packages now covered by the new codegen:
- typescript runtime
- typescript infrastructure
- typescript handlers
- typescript hooks
  • Loading branch information
cogwirrel authored Sep 30, 2024
1 parent 218be66 commit b9e2dfb
Show file tree
Hide file tree
Showing 81 changed files with 3,685 additions and 4,971 deletions.
4 changes: 4 additions & 0 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public void testSmithyAsyncTransformerAddsHttpTrait() {
.settings(Node.objectNode())
.build());

OperationShape operation = result.getShape(ShapeId.from("com.aws#SayHello")).orElseThrow().asOperationShape().orElseThrow();
OperationShape operation = result.getShape(ShapeId.from("com.aws#SayHello"))
.orElseThrow(() -> new RuntimeException()).asOperationShape().orElseThrow(() -> new RuntimeException());

assertTrue(operation.hasTrait(HttpTrait.ID));
assertTrue(operation.hasTrait("com.aws#async"));
Expand All @@ -45,7 +46,8 @@ public void testSmithyAsyncTransformerAddsRestJson1Trait() {
.settings(Node.objectNode())
.build());

ServiceShape service = result.getShape(ShapeId.from("com.aws#MyService")).orElseThrow().asServiceShape().orElseThrow();
ServiceShape service = result.getShape(ShapeId.from("com.aws#MyService"))
.orElseThrow(() -> new RuntimeException()).asServiceShape().orElseThrow(() -> new RuntimeException());

assertTrue(service.hasTrait(RestJson1Trait.ID));
assertTrue(service.hasTrait("com.aws#websocketJson"));
Expand Down
1 change: 1 addition & 0 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions packages/pdk/.projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/pdk/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/type-safe-api/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions packages/type-safe-api/.projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/type-safe-api/.projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/type-safe-api/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b9e2dfb

Please sign in to comment.