All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- smart service detection - you can use
rails g twirp svc
if youSvc
orSvcAPI
service described atcompany/service/subservice/version/etc/svc_api.proto
- Add
# :nocov:
comment to generated modules to avoid decrease coverage - Improve generator console output and error handling
add_api_acronym
configuration option
protoc
path was cached on start and didn't reload with spring
- Client and server proto directory splits from
app/protos
torpc
andrpc/clients
(configurable)
- Added gem configuration and generator to create initial configuration file
rails g twirp:init
(comments inside). - Proto source dirs and rb destination dirs now configurable.
- Added separate generator to run protoc on clients proto files
rails g twirp:clients
. - Add acronym API to Rails inflector to correct generate
ServiceAPI
handler fromServiceApi
as protoc twirp plugin. - In the development environment gem uses warn instead of raise errors on incorrect generated code or invalid service routes.
- Fixed incorrect indent in generated modules.
- Correct code generation for proto files with packages.
- Fix default log subscriber to use string keys to avoid SemanticLogger use :exception as parameter
- Ability to detailed log twirp calls. Add
TwirpRails.log_twirp_calls!
to the initializer.
- Services not been instrumented via
ActiveSupport::Notifications
unlessTwirpRails.log_twirp_calls!
used.
mount_twirp
now (by default) mounts to path /twirp/Service instead of /Service. If you want to use old behavior addscope: nil
argument.
- Services mounted by
mount_twirp
now correctly report errors toRaven
(ifraven
gem used) and instrument calls viaActiveSupport::Notifications
.
- initial install rspec helper code moved to the
twirp:rspec
generator.
- initial inject required rspec helper required code moved to the
twirp:rspec
generator.
rails g twirp service
generates swagger file at public/swagger, options to skip it or set output pathrails g twirp service
generates handler rspec test
- rspec
rpc
helper try to camelize tested method name if it not exists
to_twirp
andtwirp_message
methods to easy convert active record models to protobuf DTOs- rspec helper to test twirp handlers with
rpc
helper
config.include TwirpRails::RSpec::Helper, type: :rpc, file_path: %r{spec/rpc}
# ...
describe TeamsHandler do
let!(:team) { create :team }
context '#get' do
rpc { [:get, id: team.id] }
it { should match(team: team.to_twirp.symbolize_keys) }
end
end
- convert package.message type to Package::Message
- twirp_ruby missing module workaround arthurnn/twirp-ruby#48
- fix generator description bug not catched by tests
- import directive support
- generator always renews all generated _twirp and _pb files from all protos to support import directive
- lib/twirp added to $LOAD_PATH
- mount_twirp route helper
- rails g twirp generator