Smithy SDK code generator for Ruby.
WARNING: This branch is under active development. All interfaces are subject to change.
For previous pre-release, Java based Smithy-Ruby, see: smithy-ruby/main
Sync protocol tests from the pinned smithy-protocol-tests Maven artifact:
bundle exec rake smithy:sync-protocol-testsThis does not fetch the latest upstream tests. It rebuilds from the version pinned in gems/smithy/spec/protocol_tests/smithy-build.json.
To pull in newer upstream protocol test cases, update the dependency versions there first, for example:
{
"maven": {
"dependencies": [
"software.amazon.smithy:smithy-protocol-traits:1.74.0",
"software.amazon.smithy:smithy-protocol-tests:1.74.0"
]
}
}Then rerun:
bundle exec rake smithy:sync-protocol-testsAvailable versions are published on Maven Central.
Run the generated protocol-test suite with:
bundle exec rake smithy:spec:protocolsBuild the local projections using the Smithy CLI:
cd projections && bundle exec smithy build --debugBuild the Weather projection using the smithy-ruby executable:
cd projections && SMITHY_PLUGIN_DIR=build/smithy/source/smithy-ruby bundle exec smithy-ruby smith client --gem-name weather --gem-version 1.0.0 --destination-root weather <<< $(smithy ast model/weather.smithy)Load the generated Weather gem:
irb -I projections/weather/lib -I gems/smithy-client/lib -I gems/smithy-schema/lib -I gems/smithy-cbor/lib -r weatherCreate a client:
protocol = Smithy::Client::RpcV2Cbor.new
client = Weather::Client.new(stub_responses: true, protocol: protocol, endpoint: 'https://example.com')
client.get_city(city_id: '1')
client.get_current_timeBuild a fixture:
export SMITHY_PLUGIN_DIR=build/smithy/source/smithy-ruby
bundle exec smithy-ruby smith client --gem-name fixture --gem-version 1.0.0 <<< $(cat gems/smithy/spec/fixtures/endpoints/default-values/model.json)Sync and validate the fixtures:
bundle exec rake smithy:sync-fixturesRun the smithy gem unit specs:
bundle exec rake smithy:spec:unitRun specs for the runtime gems:
bundle exec rake smithy-schema:spec
bundle exec rake smithy-client:spec
bundle exec rake smithy-cbor:spec
bundle exec rake smithy-json:spec
bundle exec rake smithy-xml:specRun all smithy gem RBS validation, including unit, endpoint provider, and protocol-test specs:
bundle exec rake smithy:rbsRun RBS validation for the runtime gems:
bundle exec rake smithy-schema:rbs
bundle exec rake smithy-client:rbs
bundle exec rake smithy-cbor:rbs
bundle exec rake smithy-json:rbs
bundle exec rake smithy-xml:rbs