-
Notifications
You must be signed in to change notification settings - Fork 14
bootstrap quickstart kotlin example #167
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| plugins { | ||
| application | ||
| kotlin("jvm") version "2.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can / should we use a version catalog?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this to use a version catalog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: CoffeeShop 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.