@@ -17,13 +17,19 @@ are as follows:
17
17
2 . Create a ` build.gradle.kts ` file with the following contents:
18
18
19
19
``` 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
+ }
27
33
```
28
34
29
35
3 . Create a ` smithy-build.json ` file with the following contents,
@@ -32,29 +38,56 @@ are as follows:
32
38
create.:
33
39
34
40
``` 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
+ }
48
55
49
56
```
50
57
51
58
4 . Create a directory named ` model ` . This is where all of your Smithy models
52
59
will go.
53
60
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
55
88
[Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html)).
56
89
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`.
58
91
59
92
See [the Smithy documentation](https://awslabs.github.io/smithy/guides/building-models/gradle-plugin.html)
60
93
for more information on build Smithy projects with Gradle.
0 commit comments