jsonrpc-middleware 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.aiexclude +5 -0
  3. data/.claude/commands/document.md +105 -0
  4. data/.claude/docs/yard.md +602 -0
  5. data/.claude/settings.local.json +2 -1
  6. data/.env.example +5 -0
  7. data/.tool-versions +1 -1
  8. data/CHANGELOG.md +38 -2
  9. data/CLAUDE.md +114 -0
  10. data/README.md +42 -102
  11. data/Rakefile +59 -1
  12. data/examples/README.md +38 -0
  13. data/examples/procedures.rb +6 -1
  14. data/examples/rack/Gemfile.lock +6 -6
  15. data/examples/rack/README.md +26 -1
  16. data/examples/rack/app.rb +1 -1
  17. data/examples/rack-echo/Gemfile.lock +6 -6
  18. data/examples/rack-echo/README.md +23 -1
  19. data/examples/rack-single-file/README.md +37 -0
  20. data/examples/rack-single-file/config.ru +54 -0
  21. data/examples/rails/.gitignore +21 -0
  22. data/examples/rails/Gemfile +15 -0
  23. data/examples/rails/Gemfile.lock +261 -0
  24. data/examples/rails/README.md +32 -0
  25. data/examples/rails/Rakefile +8 -0
  26. data/examples/rails/app/controllers/application_controller.rb +4 -0
  27. data/examples/rails/app/controllers/jsonrpc_controller.rb +44 -0
  28. data/examples/rails/bin/dev +4 -0
  29. data/examples/rails/bin/rails +6 -0
  30. data/examples/rails/bin/rake +6 -0
  31. data/examples/rails/bin/setup +28 -0
  32. data/examples/rails/config/application.rb +47 -0
  33. data/examples/rails/config/boot.rb +5 -0
  34. data/examples/rails/config/credentials.yml.enc +1 -0
  35. data/examples/rails/config/environment.rb +7 -0
  36. data/examples/rails/config/environments/development.rb +42 -0
  37. data/examples/rails/config/environments/production.rb +60 -0
  38. data/examples/rails/config/environments/test.rb +44 -0
  39. data/examples/rails/config/initializers/cors.rb +18 -0
  40. data/examples/rails/config/initializers/filter_parameter_logging.rb +10 -0
  41. data/examples/rails/config/initializers/inflections.rb +18 -0
  42. data/examples/rails/config/initializers/jsonrpc.rb +62 -0
  43. data/examples/rails/config/locales/en.yml +31 -0
  44. data/examples/rails/config/puma.rb +40 -0
  45. data/examples/rails/config/routes.rb +14 -0
  46. data/examples/rails/config.ru +8 -0
  47. data/examples/rails/public/robots.txt +1 -0
  48. data/examples/rails-single-file/README.md +23 -0
  49. data/examples/rails-single-file/config.ru +71 -0
  50. data/examples/rails-single-file-routing/README.md +53 -0
  51. data/examples/rails-single-file-routing/config.ru +62 -0
  52. data/examples/sinatra-classic/Gemfile +9 -0
  53. data/examples/sinatra-classic/Gemfile.lock +95 -0
  54. data/examples/sinatra-classic/README.md +32 -0
  55. data/examples/sinatra-classic/app.rb +52 -0
  56. data/examples/sinatra-classic/config.ru +6 -0
  57. data/examples/sinatra-modular/Gemfile +9 -0
  58. data/examples/sinatra-modular/Gemfile.lock +95 -0
  59. data/examples/sinatra-modular/README.md +32 -0
  60. data/examples/sinatra-modular/app.rb +57 -0
  61. data/examples/sinatra-modular/config.ru +6 -0
  62. data/lib/jsonrpc/batch_request.rb +67 -2
  63. data/lib/jsonrpc/batch_response.rb +56 -0
  64. data/lib/jsonrpc/configuration.rb +156 -14
  65. data/lib/jsonrpc/error.rb +83 -2
  66. data/lib/jsonrpc/errors/internal_error.rb +14 -2
  67. data/lib/jsonrpc/errors/invalid_params_error.rb +13 -1
  68. data/lib/jsonrpc/errors/invalid_request_error.rb +8 -0
  69. data/lib/jsonrpc/errors/method_not_found_error.rb +8 -0
  70. data/lib/jsonrpc/errors/parse_error.rb +8 -0
  71. data/lib/jsonrpc/helpers.rb +212 -21
  72. data/lib/jsonrpc/middleware.rb +211 -5
  73. data/lib/jsonrpc/notification.rb +58 -0
  74. data/lib/jsonrpc/parser.rb +30 -0
  75. data/lib/jsonrpc/railtie/method_constraint.rb +35 -0
  76. data/lib/jsonrpc/railtie.rb +58 -0
  77. data/lib/jsonrpc/request.rb +68 -1
  78. data/lib/jsonrpc/response.rb +76 -0
  79. data/lib/jsonrpc/validator.rb +67 -6
  80. data/lib/jsonrpc/version.rb +11 -1
  81. data/lib/jsonrpc.rb +56 -1
  82. metadata +53 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e61b560d7db3538454d0d5206eaea1fc2a86a01b25294c4d56de4b6237dd120
4
- data.tar.gz: 1d7255ba3a462bbc9d53efbec3ba9b242f773b2c4fa270de280b951ea3b05743
3
+ metadata.gz: be698b3797653f7d1139c034b97f4be0895cc181f840c4fe3d9edfb9624fb0a2
4
+ data.tar.gz: 3276fd9d13964cf6fe92f9a64ffe5bfac21bef767b3fde94328bc744ca2c8731
5
5
  SHA512:
6
- metadata.gz: b3d9b2f802ac5ffd1f342c45d00e001113ebf857e09208deac8560dd75a06f6201bcc4e7a99f0184cb6c1a48497d70e922d59d7f6b476c93f530584b60fa0066
7
- data.tar.gz: b07c00f97c85c9a41f82decf00dbf58f10c2655e1011f0e3e6d5e63ff2f90cee88e310f6c892a8d49c2ec94aea5cfa7dccdf9292b7940256f82b1591823df2e2
6
+ metadata.gz: e4da3b7c0bd1fedc61baa9b8c4e9dc7fbd90c60c3e8509a676bd72b35d224a5928280bb56c5c4a7c92a40e5958544b81544e8461a551be818b8dd41b433416c0
7
+ data.tar.gz: cd7f389f4bf622cd9191c19dbba17890fa260259bd590d8d4bf9629dfc49f7573a05b772f25050c283fedc3b7f1d3899828ae1009a3b5deb52bc9911264c94ab
data/.aiexclude ADDED
@@ -0,0 +1,5 @@
1
+ .kiro
2
+ .ruby-lsp
3
+ .vscode
4
+ coverage
5
+ doc
@@ -0,0 +1,105 @@
1
+ # Document
2
+
3
+ Generates documentation for Ruby code using YARD with 100% coverage enforcement.
4
+
5
+ ## Commands
6
+
7
+ Generate documentation:
8
+ ```bash
9
+ bundle exec rake yard
10
+ ```
11
+
12
+ Format YARD comments:
13
+ ```bash
14
+ bundle exec rake yard:format
15
+ ```
16
+
17
+ Verify 100% documentation coverage:
18
+ ```bash
19
+ bundle exec rake verify_measurements
20
+ ```
21
+
22
+ Check for documentation quality issues:
23
+ ```bash
24
+ bundle exec rake yard:junk
25
+ ```
26
+
27
+ Generate coverage report:
28
+ ```bash
29
+ bundle exec rake yardstick_measure
30
+ ```
31
+
32
+ ## Configuration
33
+
34
+ Requires `.yardstick.yml` in project root with 100% threshold:
35
+ ```yaml
36
+ threshold: 100
37
+ rules:
38
+ ApiTag::Presence: { enabled: true }
39
+ ApiTag::Inclusion: { enabled: true }
40
+ ApiTag::ProtectedMethod: { enabled: true }
41
+ ApiTag::PrivateMethod: { enabled: true }
42
+ ExampleTag: { enabled: true }
43
+ ReturnTag: { enabled: true }
44
+ Summary::Presence: { enabled: true }
45
+ Summary::Delimiter: { enabled: true }
46
+ ```
47
+
48
+ ## Coverage Report
49
+
50
+ After running measurement, check detailed line-by-line issues:
51
+ ```bash
52
+ cat measurements/report.txt
53
+ ```
54
+
55
+ Report shows specific file, line number, method, and documentation issues that need fixing.
56
+
57
+ ## Documentation Standards
58
+
59
+ ### Required Tags
60
+ - Every public/private method, class, and module requires `@api public` or `@api private`
61
+ - All parameters: `@param name [Type] Description`
62
+ - All returns: `@return [Type] Description` (use `[void]` if no return)
63
+ - Examples required for all public methods: `@example Description`
64
+ - Error conditions: `@raise [ExceptionClass] When this occurs`
65
+
66
+ ### Type Notation
67
+ - Use `String` not `string`
68
+ - Arrays: `Array<String>` for string arrays
69
+ - Hashes: `Hash{String=>Object}` for hash types
70
+ - Use `Boolean` not `bool`, `Integer` not `int`
71
+ - Nullable types: `String, nil` or `String|nil`
72
+
73
+ ### Formatting Rules
74
+ - Blank lines required between YARD tag groups
75
+ - Exception: `@param` and `@option` tags can be grouped together
76
+ - Wrap class/method names in `+` markers: `+PrivateKey+`
77
+ - Cross-reference related methods: `@see #other_method`
78
+
79
+ ### Documentation Structure
80
+ ```ruby
81
+ # Brief one-line summary ending with period.
82
+ #
83
+ # @api public
84
+ #
85
+ # @example Description of example
86
+ # code_example
87
+ # result # => expected_output
88
+ #
89
+ # @param name [Type] Description
90
+ # @param other [Type] Other description
91
+ #
92
+ # @return [Type] Description
93
+ #
94
+ # @raise [ExceptionClass] When this exception occurs
95
+ #
96
+ def method_name
97
+ end
98
+ ```
99
+
100
+ ## Integration
101
+
102
+ Documentation verification is included in the quality assurance pipeline:
103
+ ```bash
104
+ bundle exec rake qa
105
+ ```