Skip to content
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

Update README example #501

Merged
merged 1 commit into from
Jan 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 55 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ are as follows:
2. Create a `build.gradle.kts` file with the following contents:

```kotlin
plugins {
id("software.amazon.smithy").version("0.4.3")
}

dependencies {
implementation("software.amazon.smithy:smithy-typescript-codegen:0.1.0")
}
plugins {
id("software.amazon.smithy").version("0.6.0")
}

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation("software.amazon.smithy:smithy-model:[1.16.0, 2.0[")
implementation("software.amazon.smithy:smithy-typescript-codegen:0.8.0")
}
```

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

```json
{
"version": "1.0",
"plugins": {
"typescript-codegen": {
"service": "example.weather#Weather",
"package": "weather",
"packageVersion": "0.0.1",
"packageJson": {
"license": "Apache-2.0"
}
}
}
}
{
"version": "1.0",
"plugins": {
"typescript-codegen": {
"service": "smithy.example#ExampleService",
"targetNamespace": "SmithyExample",
"package": "smithyexample",
"packageVersion": "0.0.1",
"packageJson": {
"license": "Apache-2.0"
}
}
}
}

```

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

5. Run `gradle build` (alternatively, you can use a
5. Create a file in the `model` directory named `main.smithy` with the following contents:

```
namespace smithy.example

service ExampleService {
version: "2022-01-01",
operations: [EchoOperation]
}

operation Echo {
input: EchoInput,
output: EchoOutput,
}

@input
structure EchoInput {
message: String,
}

@output
structure EchoOutput {
message: String
}
```

6. Run `gradle build` (alternatively, you can use a
[Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html)).

6. The generated client can be found in `build/smithyprojections/foo-client/source/typescript-codegen`.
7. The generated client can be found in `build/smithyprojections/foo-client/source/typescript-codegen`.

See [the Smithy documentation](https://awslabs.github.io/smithy/guides/building-models/gradle-plugin.html)
for more information on build Smithy projects with Gradle.
Expand Down