bootstrap quickstart kotlin example#167
Conversation
|
|
||
| plugins { | ||
| application | ||
| kotlin("jvm") version "2.2.0" |
There was a problem hiding this comment.
2.3.0 is the latest version, can we use that?
| val coroutinesCoreVersion: String by project | ||
| val smithyKotlinCodegenVersion: String by project | ||
| val smithyKotlinRuntimeVersion: String by project |
There was a problem hiding this comment.
Can / should we use a version catalog?
There was a problem hiding this comment.
Updated this to use a version catalog
There was a problem hiding this comment.
I think we need it for the Java Kotlin server to work. When I remove it I get:
Projection source failed: software.amazon.smithy.codegen.core.CodegenException: Header file /Users/aoperez/Documents/kotlinSdkWork/smithyExamples/smithy-examples/smithy-kotlin-examples/quickstart-kotlin/server/../license.txt does not exist.
| @@ -0,0 +1,53 @@ | |||
| description = "Cafe service client" | |||
| public class CafeService implements Runnable { | ||
| private static final Logger LOGGER = Logger.getLogger(CafeService.class.getName()); | ||
|
|
||
| public static void main(String... args) throws InterruptedException, ExecutionException { | ||
| new CafeService().run(); | ||
| } |
There was a problem hiding this comment.
Nit: The client is named CoffeeShopClient so for clarity this should be named CoffeeShopService (not Cafe). Applies in other files too.
| logger.info("Waiting for order to complete.") | ||
| delay(5.seconds) | ||
|
|
||
| logger.info("Checking order status") | ||
| val orderStatus = client.getOrder { | ||
| id = createOrderResponse.id | ||
| }.status | ||
|
|
||
| logger.info("Order status: $orderStatus") |
There was a problem hiding this comment.
Maybe we can make this a little more comprehensive example by explicitly waiting until the order status is OrderStatus.COMPLETED
| [versions] | ||
| smithyVersion="1.63.0" | ||
| smithyJavaVersion="0.0.1" | ||
| smithyKotlinCodegenVersion="0.35.25" | ||
| smithyKotlinRuntimeVersion="1.5.25" | ||
| coroutinesCoreVersion="1.10.2" |
There was a problem hiding this comment.
nit: version catalogs typically use kebab-case instead of camelCase
| @@ -0,0 +1,21 @@ | |||
| description = "Smithy definition of a Cafe service." | |||
There was a problem hiding this comment.
Nit: This still says "Cafe" instead of "CoffeeShop"
Background
What do these changes do?
Add a Smithy Kotlin quick start example.
Was a new example added? If so, what does it demonstrate?
Yes, how to quickly get started with Smithy Kotlin client code generation.
Testing
How did you test these changes?
Ran the quick start example server and client.
Was an integration test added for any new examples?
No.
If a new example was added did you update the
smithy-templates.jsonfile?Yes.
Links
See: https://github.com/smithy-lang/smithy-kotlin
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT-0 license.