Skip to content

AndrewFossAWS/smithy-ruby

 
 

Repository files navigation

Smithy Ruby

Smithy SDK code generators for Ruby and SDK core libraries.

WARNING: All interfaces are subject to change.

License

Generating an SDK for a Rails JSON API

  1. Create a new gradle project
  2. Add smithy to the plugins list (Note, you can find the latest plugin version at: https://plugins.gradle.org/plugin/software.amazon.smithy)
plugins {
    id("software.amazon.smithy").version("0.6.0")
}
  1. Add the smithy-ruby-rails-codegen as a dependency:
dependencies {
    implementation("software.amazon.smithy.ruby:smithy-ruby-rails-codegen:0.1.0")
}
  1. Add your smithy model. under <project_root>/model.

  2. Create a smithy-build.json file that defines how Smithy should build your SDK. It must define a section under plugins for ruby-codegen. For reference see: rails json test smithy-build.json.

  3. Execute the gradle build task. This will generate the SDK from your model using the settings from your smithy-build.json file.
    The generated SDK will be available under the build/smithyprojections/<project_name>//ruby-codegen folder.

License

This project is licensed under the Apache-2.0 License.

Security

See CONTRIBUTING for more information.

Development

Design Documentation (WIP)

Troubleshooting

Many Gradle issues can be fixed by stopping the daemon by running ./gradlew --stop

Testing

Running codegen integration tests

Codegen integration tests are written as ruby rspec tests (under smithy-ruby-codegentest/integration-specs). The gradle :smithy-ruby-codegen-test:build target will create a sample_service_real directory and copy the specs into it. From that directory, run rspec (assuming you have required dependencies installed).

These tests run against the generated test sdk defined by the high-score model in the smithy-ruby-codegen-test project.

Running hearth unit tests.

Hearth has a full suite of rspec tests which can be run from the hearth directory with: rspec.

Manual Testing

The sample-service directory defines a rails service that can be run with rails s. You can then test manually by adding hearth and the generated sdk client to your library path with:

irb -I 'hearth/lib' -I 'codegen/projections/high_score_service/lib'

And test with:

require 'high_score_service'

c = HighScoreService::Client.new(endpoint: 'http://127.0.0.1:3000')
c.get_high_score(id: '1')

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 52.5%
  • Ruby 30.4%
  • Smithy 15.4%
  • Kotlin 1.7%