Skip to content

Commit 32ff8a7

Browse files
committed
Update the changelog for v0.5.0
1 parent 0626bba commit 32ff8a7

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,70 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.0] - 2025-07-22
9+
10+
### Added
11+
- Rails routing DSL for elegant JSON-RPC method mapping with support for namespaces and batch handling:
12+
```ruby
13+
# In routes.rb
14+
jsonrpc '/' do
15+
# Handle batch requests
16+
batch to: 'batch#handle'
17+
18+
method 'on', to: 'main#on'
19+
method 'off', to: 'main#off'
20+
21+
namespace 'lights' do
22+
method 'on', to: 'lights#on' # becomes lights.on
23+
method 'off', to: 'lights#off' # becomes lights.off
24+
end
25+
26+
namespace 'climate' do
27+
method 'on', to: 'climate#on' # becomes climate.on
28+
method 'off', to: 'climate#off' # becomes climate.off
29+
30+
namespace 'fan' do
31+
method 'on', to: 'fan#on' # becomes climate.fan.on
32+
method 'off', to: 'fan#off' # becomes climate.fan.off
33+
end
34+
end
35+
end
36+
```
37+
- `JSONRPC::BatchConstraint` for routing JSON-RPC batch requests to dedicated controllers:
38+
```ruby
39+
# Handle batch requests with custom constraint
40+
post '/api', to: 'api#handle_batch', constraints: JSONRPC::BatchConstraint.new
41+
42+
# Or use the DSL (recommended)
43+
jsonrpc '/api' do
44+
batch to: 'api#handle_batch'
45+
end
46+
```
47+
48+
### Changed
49+
- Procedure registration now supports optional validation blocks (defaults to empty contract):
50+
```ruby
51+
# Before: Always required validation block (even if empty)
52+
procedure('ping') do
53+
params do
54+
# No params needed
55+
end
56+
end
57+
58+
# After: Optional validation block
59+
procedure('ping') # Uses empty contract by default
60+
61+
# Still works with validation when needed
62+
procedure('add') do
63+
params do
64+
required(:a).value(:integer)
65+
required(:b).value(:integer)
66+
end
67+
end
68+
```
69+
- Simplified example configurations by removing unnecessary empty validation blocks
70+
- Enhanced Rails integration with automatic DSL registration via Railtie
71+
872
## [0.4.0] - 2025-07-18
973

1074
### Added
@@ -71,6 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
71135
- Helper methods for request and response processing
72136
- Examples for basic and advanced usage scenarios
73137

138+
[0.5.0]: https://github.com/wilsonsilva/jsonrpc-middleware/compare/v0.4.0...v0.5.0
74139
[0.4.0]: https://github.com/wilsonsilva/jsonrpc-middleware/compare/v0.3.0...v0.4.0
75140
[0.3.0]: https://github.com/wilsonsilva/jsonrpc-middleware/compare/v0.2.0...v0.3.0
76141
[0.2.0]: https://github.com/wilsonsilva/jsonrpc-middleware/compare/v0.1.0...v0.2.0

0 commit comments

Comments
 (0)