sealink-param-validation 0.3.0 → 0.4.1
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.
- checksums.yaml +4 -4
- data/.git-blame-ignore-revs +12 -0
- data/.github/workflows/ruby.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +11 -1
- data/CLAUDE.md +36 -0
- data/lib/sealink_param_validation/version.rb +1 -1
- data/sealink_param_validation.gemspec +3 -2
- data/spec/spec_helper.rb +1 -1
- metadata +24 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 91fcc915de81a06eb86ec0cb48450a5a20ecdb06a89482a2ebeeaa356377af60
|
|
4
|
+
data.tar.gz: ca757a397d0ef962647886143e504a9df9f57f5f557d0763246d43c02a072308
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33444146ba69316039d29c44be04b8248fe7d26e11c9e205f6d531d4657c7f1f5cdbea3cc3e2a010be9dcddfc07b2de65af656c166feb27d90aa2bc77ffea31b
|
|
7
|
+
data.tar.gz: d31be6a8d8dd1011e780f3d9564bc6ff145800c3512af6caaa9f29f760676818cdbdbf5ed99f879835fe0928db725d3db21ce2ada6efa4b985fe95bd04ead841
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# The commits that did automated reformatting. You can ignore them
|
|
2
|
+
# during git-blame with `--ignore-rev` or `--ignore-revs-file`.
|
|
3
|
+
# You can also globally configure GIT with the following command
|
|
4
|
+
#
|
|
5
|
+
# $ git config --add 'blame.ignoreRevsFile' '.git-blame-ignore-revs'
|
|
6
|
+
#
|
|
7
|
+
# Example entries:
|
|
8
|
+
#
|
|
9
|
+
# <full commit hash> # initial black-format
|
|
10
|
+
# <full commit hash> # rename something internal
|
|
11
|
+
|
|
12
|
+
b57e744f2a3bd9fa42c97325cc6fd6a87db66d9c # Pretty CHANGELOG.md
|
data/.github/workflows/ruby.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.2.0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Sealink Param Validation
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.4.1
|
|
6
|
+
|
|
7
|
+
- [TBAU-1724] Remove unused Rails dependencies
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
- [PLAT-1175] Update to Ruby 3.2
|
|
12
|
+
|
|
3
13
|
## 0.3.0
|
|
4
14
|
|
|
5
15
|
- [PLAT-183] Implement coverage check / ruby 3.1 / rails 7.0
|
|
@@ -10,4 +20,4 @@
|
|
|
10
20
|
|
|
11
21
|
## 0.1.0
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
- [TT-6430] Extract our param validation from QuickTravel
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Ruby gem (`sealink-param-validation`) that provides Rails controller parameter validation using dry-schema. Controllers include `SealinkParamValidation::Concern` and declare schemas per action via `schema_for`. Invalid params return 422 with error messages.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bundle install # Install dependencies
|
|
13
|
+
bundle exec rspec # Run all tests
|
|
14
|
+
bundle exec rspec spec/helper_spec.rb # Run a single spec file
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Architecture
|
|
18
|
+
|
|
19
|
+
- **`lib/sealink_param_validation/concern.rb`** — ActiveSupport::Concern included in controllers. `schema_for(action, schema)` registers a dry-schema per action and adds a `before_action` that validates params. Two validation paths: `ensure_schema` (renders 422 JSON) and `ensure_schema!` (raises `InvalidInputError`).
|
|
20
|
+
- **`lib/sealink_param_validation/helper.rb`** — Formats dry-schema validation errors into strings. `generate_error_message` returns full error paths; `generate_humanized_error_message` returns humanized field names with `to_sentence`.
|
|
21
|
+
- **`lib/sealink_param_validation/error.rb`** — `InvalidInputError` exception class.
|
|
22
|
+
|
|
23
|
+
## Key Dependencies
|
|
24
|
+
|
|
25
|
+
- `rails` (ActiveSupport::Concern, ActionController)
|
|
26
|
+
- `dry-schema` (>= 1.0.0) for param validation schemas
|
|
27
|
+
|
|
28
|
+
## Testing
|
|
29
|
+
|
|
30
|
+
Tests use `rspec-rails` with a minimal Rails application defined in `spec/spec_helper.rb`. The validation spec creates a `DummyController` with routes to test the concern end-to-end.
|
|
31
|
+
|
|
32
|
+
## Release Process
|
|
33
|
+
|
|
34
|
+
1. Update version in `lib/sealink_param_validation/version.rb` and `CHANGELOG.md`
|
|
35
|
+
2. Create a git tag in format `v0.1.0`
|
|
36
|
+
3. Push — GitHub Actions handles the build/publish
|
|
@@ -18,9 +18,10 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.files = `git ls-files`.split($/)
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
20
20
|
spec.require_paths = ['lib']
|
|
21
|
-
spec.required_ruby_version = '>=
|
|
21
|
+
spec.required_ruby_version = '>= 3.0'
|
|
22
22
|
|
|
23
|
-
spec.add_dependency '
|
|
23
|
+
spec.add_dependency 'activesupport'
|
|
24
|
+
spec.add_dependency 'actionpack'
|
|
24
25
|
spec.add_dependency 'dry-schema', '>= 1.0.0'
|
|
25
26
|
|
|
26
27
|
spec.add_development_dependency 'bundler'
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sealink-param-validation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Earle
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: activesupport
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: actionpack
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
16
30
|
requirements:
|
|
17
31
|
- - ">="
|
|
@@ -114,12 +128,14 @@ executables: []
|
|
|
114
128
|
extensions: []
|
|
115
129
|
extra_rdoc_files: []
|
|
116
130
|
files:
|
|
131
|
+
- ".git-blame-ignore-revs"
|
|
117
132
|
- ".github/dependabot.yml"
|
|
118
133
|
- ".github/workflows/release.yml"
|
|
119
134
|
- ".github/workflows/ruby.yml"
|
|
120
135
|
- ".gitignore"
|
|
121
136
|
- ".ruby-version"
|
|
122
137
|
- CHANGELOG.md
|
|
138
|
+
- CLAUDE.md
|
|
123
139
|
- Gemfile
|
|
124
140
|
- README.md
|
|
125
141
|
- Rakefile
|
|
@@ -141,7 +157,7 @@ homepage: http://github.com/sealink/sealink-param-validation
|
|
|
141
157
|
licenses:
|
|
142
158
|
- MIT
|
|
143
159
|
metadata: {}
|
|
144
|
-
post_install_message:
|
|
160
|
+
post_install_message:
|
|
145
161
|
rdoc_options: []
|
|
146
162
|
require_paths:
|
|
147
163
|
- lib
|
|
@@ -149,15 +165,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
149
165
|
requirements:
|
|
150
166
|
- - ">="
|
|
151
167
|
- !ruby/object:Gem::Version
|
|
152
|
-
version:
|
|
168
|
+
version: '3.0'
|
|
153
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
170
|
requirements:
|
|
155
171
|
- - ">="
|
|
156
172
|
- !ruby/object:Gem::Version
|
|
157
173
|
version: '0'
|
|
158
174
|
requirements: []
|
|
159
|
-
rubygems_version: 3.
|
|
160
|
-
signing_key:
|
|
175
|
+
rubygems_version: 3.4.1
|
|
176
|
+
signing_key:
|
|
161
177
|
specification_version: 4
|
|
162
178
|
summary: This is some logic we want to use across many projects so we have extracted
|
|
163
179
|
it into a gem.
|