Skip to content
main
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

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 seahorse unit tests.

Seahorse has a full suite of rspec tests which can be run from the seahorse 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 seahorse and the generated sdk client to your library path with:

irb -I 'seahorse/lib' -I 'sample_service/lib'

And test with:

require 'sample_service'

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