Skip to content

Commit 943c84a

Browse files
Update README example (#501)
1 parent 7cb97b3 commit 943c84a

File tree

1 file changed

+55
-22
lines changed

1 file changed

+55
-22
lines changed

README.md

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ are as follows:
1717
2. Create a `build.gradle.kts` file with the following contents:
1818

1919
```kotlin
20-
plugins {
21-
id("software.amazon.smithy").version("0.4.3")
22-
}
23-
24-
dependencies {
25-
implementation("software.amazon.smithy:smithy-typescript-codegen:0.1.0")
26-
}
20+
plugins {
21+
id("software.amazon.smithy").version("0.6.0")
22+
}
23+
24+
repositories {
25+
mavenLocal()
26+
mavenCentral()
27+
}
28+
29+
dependencies {
30+
implementation("software.amazon.smithy:smithy-model:[1.16.0, 2.0[")
31+
implementation("software.amazon.smithy:smithy-typescript-codegen:0.8.0")
32+
}
2733
```
2834

2935
3. Create a `smithy-build.json` file with the following contents,
@@ -32,29 +38,56 @@ are as follows:
3238
create.:
3339

3440
```json
35-
{
36-
"version": "1.0",
37-
"plugins": {
38-
"typescript-codegen": {
39-
"service": "example.weather#Weather",
40-
"package": "weather",
41-
"packageVersion": "0.0.1",
42-
"packageJson": {
43-
"license": "Apache-2.0"
44-
}
45-
}
46-
}
47-
}
41+
{
42+
"version": "1.0",
43+
"plugins": {
44+
"typescript-codegen": {
45+
"service": "smithy.example#ExampleService",
46+
"targetNamespace": "SmithyExample",
47+
"package": "smithyexample",
48+
"packageVersion": "0.0.1",
49+
"packageJson": {
50+
"license": "Apache-2.0"
51+
}
52+
}
53+
}
54+
}
4855

4956
```
5057

5158
4. Create a directory named `model`. This is where all of your Smithy models
5259
will go.
5360

54-
5. Run `gradle build` (alternatively, you can use a
61+
5. Create a file in the `model` directory named `main.smithy` with the following contents:
62+
63+
```
64+
namespace smithy.example
65+
66+
service ExampleService {
67+
version: "2022-01-01",
68+
operations: [EchoOperation]
69+
}
70+
71+
operation Echo {
72+
input: EchoInput,
73+
output: EchoOutput,
74+
}
75+
76+
@input
77+
structure EchoInput {
78+
message: String,
79+
}
80+
81+
@output
82+
structure EchoOutput {
83+
message: String
84+
}
85+
```
86+
87+
6. Run `gradle build` (alternatively, you can use a
5588
[Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html)).
5689
57-
6. The generated client can be found in `build/smithyprojections/foo-client/source/typescript-codegen`.
90+
7. The generated client can be found in `build/smithyprojections/foo-client/source/typescript-codegen`.
5891
5992
See [the Smithy documentation](https://awslabs.github.io/smithy/guides/building-models/gradle-plugin.html)
6093
for more information on build Smithy projects with Gradle.

0 commit comments

Comments
 (0)