rspec-json_api 1.4.0 → 1.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -28
- data/README.md +320 -319
- data/lib/generators/rspec/json_api/interface/interface_generator.rb +3 -1
- data/lib/generators/rspec/json_api/type/type_generator.rb +25 -23
- data/lib/rspec/json_api/constraints.rb +58 -0
- data/lib/rspec/json_api/matchers/match_json_schema.rb +35 -11
- data/lib/rspec/json_api/schema_match.rb +162 -0
- data/lib/rspec/json_api/traversal.rb +49 -0
- data/lib/rspec/json_api/types/uri.rb +5 -1
- data/lib/rspec/json_api/types/uuid.rb +1 -1
- data/lib/rspec/json_api/version.rb +7 -7
- data/lib/rspec/json_api.rb +23 -25
- metadata +8 -26
- data/.github/workflows/main.yml +0 -20
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.rubocop.yml +0 -50
- data/.ruby-version +0 -1
- data/CODE_OF_CONDUCT.md +0 -84
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -262
- data/Rakefile +0 -12
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/lib/extensions/array.rb +0 -8
- data/lib/extensions/hash.rb +0 -36
- data/lib/generators/rspec/json_api/interface/templates/interface.erb +0 -9
- data/lib/rspec/json_api/compare_array.rb +0 -39
- data/lib/rspec/json_api/compare_hash.rb +0 -114
- data/rspec-json_api.gemspec +0 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0a09137349ac0fccf09529e902891d26148b10533b62c4d8f7731ba7529b5a3
|
|
4
|
+
data.tar.gz: 79217a3491fb7c081f86b38305574ba201d7710572312f406edb55a939dee8fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d50831bc5a1ea49bd7579524db9f61879f7568982953c1f449a4daa1a2a67b3d2a052a04e079c2bafc140832868497014bfded996d860aa60aa47b03a8f0db9e
|
|
7
|
+
data.tar.gz: 2296ba594e1acf7f9cca856386ac963ec46b0a72b286d50a38a830f3f39ed12b585ee39274af1baf56863f138d84d250820be594ea9868caddbec0a65f139e32
|
data/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,77 @@
|
|
|
1
|
-
## [Unreleased]
|
|
2
|
-
|
|
3
|
-
## [1.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [1.6.0] - 2026-09-03
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- A list schema (`[String]`, `[INTERFACE]`) fails the match instead of raising `NoMethodError` when the response holds `null` or a scalar where an array was expected. This affected nested lists too, so an interface element with a scalar in place of a list crashed the example.
|
|
7
|
+
- `Types::URI` is anchored with `\A...\z`. It previously accepted any value that merely contained a URI, so `"see https://example.com for details"` matched. `EMAIL` and `UUID` were already anchored. Suites that relied on the substring behaviour will start failing.
|
|
8
|
+
- `match_json_schema` fails with `expected a JSON String to match against the schema, got NilClass` instead of raising `TypeError` when handed `nil`, an already-parsed Hash, or any other non-String.
|
|
9
|
+
- A schema `Proc` that returns something other than an options Hash, or that expects the value as an argument, raises a descriptive `ArgumentError` naming the mistake. Both previously surfaced as a bare `NoMethodError` or `wrong number of arguments` from inside the matcher.
|
|
10
|
+
- An object schema compared against array elements of another shape (`[{ id: Integer }]` against `["a", "b"]`) fails instead of raising `NoMethodError`. This is the same class of bug as the list-schema crash above, on the object comparison path.
|
|
11
|
+
- `expect(body).not_to match_json_schema(schema)` fails when the body is not a JSON String, rather than passing by default. A type error in the spec is now a failure whichever way the expectation is written.
|
|
12
|
+
- A non-lambda `proc { |value| ... }` used as a schema Proc is rejected alongside the lambda form. Ruby reports a non-lambda block parameter as optional, so the check reads the parameter list rather than the arity; a Proc declaring an optional parameter is rejected for the same reason.
|
|
13
|
+
- The `have_no_content` specs gave every body its own context. A repeated `let(:actual)` in one context meant the `"{}"` case never ran.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- The released gem contains the tracked files under `lib/` plus the licence, the README and the CHANGELOG, and nothing else. It previously packaged the repository's own tooling: the CI workflow, the RuboCop config, the Gemfile and lockfile, the Rakefile, `bin/` and `gemfiles/`. Scoping the file list to tracked paths also keeps an untracked local file in `lib/` out of a release.
|
|
17
|
+
- README regex examples anchor with `\A` and `\z` instead of `^` and `$`, with a note explaining that the line-boundary anchors let a multi-line value satisfy a schema.
|
|
18
|
+
- Updated the locked development dependencies past every advisory `bundler-audit` reported: rack, nokogiri, railties, activesupport, concurrent-ruby, loofah, crass, erb, json, rails-html-sanitizer and rack-session.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- Exact-array schemas dispatch each element the same way any other schema value is dispatched, so `[Integer, Integer]` is a fixed-length tuple and `[RSpec::JsonApi::Types::URI]` type-checks its single element. Elements were previously compared with `==`, so a Class, Regexp or Proc in that position could never match.
|
|
22
|
+
- A `bundler-audit` job in CI, a Dependabot config for bundler and github-actions, and `permissions: contents: read` on the workflow.
|
|
23
|
+
- `ROADMAP.md`, the prioritised findings from a full review of the codebase.
|
|
24
|
+
|
|
25
|
+
## [1.5.0] - 2026-06-05
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- CI compatibility matrix across Ruby 3.2-3.4 and Rails 6.1, 7.1, 7.2, 8.0 and 8.1 (`gemfiles/` + GitHub Actions matrix), so the advertised version support is actually tested.
|
|
29
|
+
- `RSpec::JsonApi::Constraints` module encapsulating the schema `Proc` options DSL.
|
|
30
|
+
- `RSpec::JsonApi::SchemaMatch` as the single comparison entry point, and `RSpec::JsonApi::Traversal` for the internal structural helpers.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Depend on `railties` instead of the full `rails` meta-gem; the gem only uses ActiveSupport core extensions and `Rails::Generators`. Drops the dependency graph from 87 to 65 gems. The `>= 6.1.4.1` floor is unchanged.
|
|
34
|
+
- Unified array and hash comparison behind `SchemaMatch`; removed the duplicate `CompareArray` and `CompareHash` modules.
|
|
35
|
+
- Stopped monkey-patching core `Hash`/`Array`; `deep_keys`, `deep_key_paths`, `deep_sort` and `sanitize!` moved into the internal `Traversal` module.
|
|
36
|
+
- The failure diff is now built lazily, only when a match fails.
|
|
37
|
+
- An unsupported schema `Proc` option now raises `ArgumentError` instead of being silently ignored.
|
|
38
|
+
- Generators emit `# frozen_string_literal: true` and freeze the generated interface hash.
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
- Require `uri` so the built-in types load on Ruby 4.0 (previously raised `NameError` on load).
|
|
42
|
+
- Anchor the `UUID` type with `\A...\z` so multiline strings no longer pass validation.
|
|
43
|
+
- Rescue invalid JSON in `match_json_schema` instead of raising `JSON::ParserError`.
|
|
44
|
+
- Avoid a `TypeError` when a schema expects a nested object but the actual value is a scalar.
|
|
45
|
+
- Enforce key structure for interface-array elements; an element with an extra null-valued key no longer matches.
|
|
46
|
+
- Reset the memoized diff at the start of `matches?` so a reused matcher reflects the current actual value.
|
|
47
|
+
- Use `Regexp#match?` for regex comparison so it returns a Boolean instead of a match index.
|
|
48
|
+
|
|
49
|
+
### Removed
|
|
50
|
+
- Dead/broken `interface.erb` generator template.
|
|
51
|
+
|
|
52
|
+
## [1.4.0] - 2026-01-23
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
- Updated Ruby version requirement from `>= 3.0.0` to `>= 3.2.0` (required for Rails 8.1 compatibility)
|
|
56
|
+
- Maintained Rails compatibility: supports Rails `>= 6.1.4.1` including Rails 8.1
|
|
57
|
+
- Maintained ActiveSupport compatibility: supports ActiveSupport `>= 6.1.4.1` including Rails 8.1
|
|
58
|
+
- Maintained RSpec Rails compatibility: supports RSpec Rails `>= 5.0.2` (tested with Rails 8.1)
|
|
59
|
+
- Updated Bundler from 2.2.19 to 4.0.4 (latest version as of January 2026)
|
|
60
|
+
- Updated RuboCop to `~> 1.65` and updated TargetRubyVersion to 3.2
|
|
61
|
+
- Updated Rake to `~> 13.2`
|
|
62
|
+
- Updated Diffy to `~> 3.4`
|
|
63
|
+
- Updated all transitive dependencies to latest compatible versions
|
|
64
|
+
- Verified compatibility with Rails 8.1.2 while maintaining support for older Rails versions
|
|
65
|
+
- Added `rubygems_mfa_required` metadata for enhanced security
|
|
66
|
+
- Updated GitHub Actions CI workflow to use Ruby 3.2.2 and Bundler 4.0.4
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
- Fixed RuboCop style violations (trailing commas, empty literals, symbol proc usage)
|
|
70
|
+
- Fixed module function style (changed `extend self` to `module_function`)
|
|
71
|
+
- Fixed line endings in Gemfile (CRLF to LF)
|
|
72
|
+
- Fixed CI workflow bundler version mismatch
|
|
73
|
+
- Fixed README typos and improved code examples consistency
|
|
74
|
+
|
|
75
|
+
## [0.1.0] - 2021-08-24
|
|
76
|
+
|
|
77
|
+
- Initial release
|