pack_api 1.1.0 → 1.1.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/CHANGELOG.md +7 -0
- data/lib/pack_api/mapping/error_hash_to_api_attributes_transformer.rb +6 -3
- data/lib/pack_api/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45577859f35d8f1bc2b0dd6f757d548d91069c8ddde25938e0e95f1c3cdd1855
|
|
4
|
+
data.tar.gz: cc86be8a6606c8009e97f64d58d404703d297ccdce38c20c9b7d475ae32d2bde
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b3f94eb050daf22423c0b0a7ca21dd0c3539c440bf4b5262e70635b007f71f71dab3ed5038d6371f68fe0c7562b6e881cfeafcfb3a42ab5d7e1e07a327642e1
|
|
7
|
+
data.tar.gz: d49add99f1644ef9e7526690bf2bd4e0c1403241c99ad386654840ca24900489ee425d4d30b737bf8e9ef70aba174358146ea0b31b112424b939a4fb70283a82
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.1] - 2026-12-04
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Error hashes keep nested attribute errors without an index (`parent.child`), as reported for `has_one`
|
|
13
|
+
nested attributes and for `has_many` without `index_errors`. They were dropped before.
|
|
14
|
+
|
|
8
15
|
## [1.0.1] - 2025-11-11
|
|
9
16
|
|
|
10
17
|
### Fixed
|
|
@@ -5,7 +5,8 @@ module PackAPI::Mapping
|
|
|
5
5
|
# Specialized attribute transformer converting the attribute names in an ActiveRecord Error object to those
|
|
6
6
|
# that should be present in the Error Hash in the API Result object.
|
|
7
7
|
class ErrorHashToAPIAttributesTransformer < AbstractTransformer
|
|
8
|
-
|
|
8
|
+
# `parent[0].child` for indexed collections; `parent.child` for has_one and for has_many without index_errors
|
|
9
|
+
NESTED_ATTRIBUTE_ERROR_KEY = /\A\w+(?<index>\[\d+\])?\.(?<child>\w+)\z/
|
|
9
10
|
|
|
10
11
|
def initialize(config)
|
|
11
12
|
super
|
|
@@ -37,7 +38,7 @@ module PackAPI::Mapping
|
|
|
37
38
|
if child_attribute_map_class
|
|
38
39
|
child_api_attribute = api_attribute_for(child_attribute_map_class.config[:mappings], child_model_attribute)
|
|
39
40
|
end
|
|
40
|
-
"#{parent_api_attribute}
|
|
41
|
+
"#{parent_api_attribute}#{match_data[:index]}.#{child_api_attribute}"
|
|
41
42
|
end
|
|
42
43
|
end
|
|
43
44
|
|
|
@@ -63,7 +64,9 @@ module PackAPI::Mapping
|
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
def nested_attributes_with_errors(parent_attribute)
|
|
66
|
-
data_source.attribute_names.select
|
|
67
|
+
data_source.attribute_names.select do |attribute|
|
|
68
|
+
attribute.to_s.start_with?("#{parent_attribute}[", "#{parent_attribute}.")
|
|
69
|
+
end
|
|
67
70
|
end
|
|
68
71
|
|
|
69
72
|
def resource_association?(model_attribute)
|
data/lib/pack_api/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pack_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Flytedesk
|
|
@@ -140,7 +140,7 @@ dependencies:
|
|
|
140
140
|
version: '1.4'
|
|
141
141
|
- - "<"
|
|
142
142
|
- !ruby/object:Gem::Version
|
|
143
|
-
version: '
|
|
143
|
+
version: '3.0'
|
|
144
144
|
type: :development
|
|
145
145
|
prerelease: false
|
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -150,21 +150,21 @@ dependencies:
|
|
|
150
150
|
version: '1.4'
|
|
151
151
|
- - "<"
|
|
152
152
|
- !ruby/object:Gem::Version
|
|
153
|
-
version: '
|
|
153
|
+
version: '3.0'
|
|
154
154
|
- !ruby/object:Gem::Dependency
|
|
155
155
|
name: rack
|
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
|
157
157
|
requirements:
|
|
158
158
|
- - "~>"
|
|
159
159
|
- !ruby/object:Gem::Version
|
|
160
|
-
version: '2
|
|
160
|
+
version: '3.2'
|
|
161
161
|
type: :development
|
|
162
162
|
prerelease: false
|
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
|
164
164
|
requirements:
|
|
165
165
|
- - "~>"
|
|
166
166
|
- !ruby/object:Gem::Version
|
|
167
|
-
version: '2
|
|
167
|
+
version: '3.2'
|
|
168
168
|
- !ruby/object:Gem::Dependency
|
|
169
169
|
name: rails
|
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -262,14 +262,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
262
262
|
requirements:
|
|
263
263
|
- - ">="
|
|
264
264
|
- !ruby/object:Gem::Version
|
|
265
|
-
version: 3.
|
|
265
|
+
version: 3.4.0
|
|
266
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
267
|
requirements:
|
|
268
268
|
- - ">="
|
|
269
269
|
- !ruby/object:Gem::Version
|
|
270
270
|
version: '0'
|
|
271
271
|
requirements: []
|
|
272
|
-
rubygems_version: 4.0.
|
|
272
|
+
rubygems_version: 4.0.20
|
|
273
273
|
specification_version: 4
|
|
274
274
|
summary: Building blocks for implementing APIs around domain models
|
|
275
275
|
test_files: []
|