verquest 0.6.0 → 0.6.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 +9 -4
- data/README.md +5 -3
- data/lib/verquest/gem_version.rb +1 -1
- data/lib/verquest/transformer.rb +17 -18
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48e1067531cf426f709ebe2dfffe4548cfd161b19f9481ca87599a0152e1fcab
|
4
|
+
data.tar.gz: d4387ad9de93bceebb05e94b69560f43f7b374cad28588a3ff0599d9f8d17667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc95249593570b003e7dc49881fe4a3a34a60efc535be6f1803c17db7cd6475317eaacb0c9ff5c1f11ba24bb18ff5065d86d070be92e24f7ff4d1e1fa88f14e9
|
7
|
+
data.tar.gz: 8d915f5cbd2f3fdfea67a1d94f13803d9a1125db6a8a21fe3cec81233693017391e40f69feee0fd9a60a8bb6926764cc0d7de1c77a3746c7ef87e2672acdd978
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.6.1] - 2025-10-13
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
- Mapping for collections (array of objects). ([#15](https://github.com/verquest/verquest/pull/15), [@CiTroNaK](https://github.com/CiTroNaK))
|
7
|
+
|
3
8
|
## [0.6.0] - 2025-07-18
|
4
9
|
|
5
10
|
### Breaking Changes
|
6
|
-
- **BREAKING:** Switching to slash notation for mapping to improve consistency with how properties are referenced in JSON Schema. Before: `example.nested.property`, now: `example/nested/property`. ([#12](https://github.com/
|
11
|
+
- **BREAKING:** Switching to slash notation for mapping to improve consistency with how properties are referenced in JSON Schema. Before: `example.nested.property`, now: `example/nested/property`. ([#12](https://github.com/verquest/verquest/pull/12), [@CiTroNaK](https://github.com/CiTroNaK))
|
7
12
|
|
8
13
|
### New Features
|
9
|
-
- Add support for `enum` properties. ([#13](https://github.com/
|
10
|
-
- Add support for inverted mapping, that can be used to map internal structure to external representation (e.g., for errors). ([#10](https://github.com/
|
11
|
-
- Add support for constants in the schema, allowing to define fixed values for properties. ([#11](https://github.com/
|
14
|
+
- Add support for `enum` properties. ([#13](https://github.com/verquest/verquest/pull/13), [@CiTroNaK](https://github.com/CiTroNaK))
|
15
|
+
- Add support for inverted mapping, that can be used to map internal structure to external representation (e.g., for errors). ([#10](https://github.com/verquest/verquest/pull/10), [@CiTroNaK](https://github.com/CiTroNaK))
|
16
|
+
- Add support for constants in the schema, allowing to define fixed values for properties. ([#11](https://github.com/verquest/verquest/pull/11), [@CiTroNaK](https://github.com/CiTroNaK))
|
12
17
|
|
13
18
|
## [0.5.0] - 2025-07-01
|
14
19
|
|
data/README.md
CHANGED
@@ -12,7 +12,9 @@ Verquest is a Ruby gem that offers an elegant solution for versioning API reques
|
|
12
12
|
- Generating components for OpenAPI documentation
|
13
13
|
- Mapping error keys back to the external API structure
|
14
14
|
|
15
|
-
|
15
|
+
Sponsored by [Stora](https://stora.co)
|
16
|
+
|
17
|
+
> The gem is still in development. Until version 1.0, the API may change. There are some features like `oneOf`, `anyOf`, `allOf` that are not implemented yet. See open [issues](https://github.com/verquest/verquest/issues?q=sort:updated-desc%20is:issue%20is:open%20label:enhancement).
|
16
18
|
|
17
19
|
## Installation
|
18
20
|
|
@@ -619,7 +621,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
619
621
|
|
620
622
|
## Contributing
|
621
623
|
|
622
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
624
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/verquest/verquest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/verquest/verquest/blob/main/CODE_OF_CONDUCT.md).
|
623
625
|
|
624
626
|
## License
|
625
627
|
|
@@ -627,4 +629,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
627
629
|
|
628
630
|
## Code of Conduct
|
629
631
|
|
630
|
-
Everyone interacting in the Verquest project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
632
|
+
Everyone interacting in the Verquest project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/verquest/verquest/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/verquest/gem_version.rb
CHANGED
data/lib/verquest/transformer.rb
CHANGED
@@ -113,30 +113,23 @@ module Verquest
|
|
113
113
|
|
114
114
|
case data
|
115
115
|
when Hash
|
116
|
-
# Only check for string keys
|
117
116
|
return nil unless data.key?(key.to_s)
|
118
|
-
|
119
|
-
# Always use string keys
|
120
117
|
value = data[key.to_s]
|
121
|
-
|
122
118
|
if current_part[:array] && value.is_a?(Array)
|
123
|
-
# Process
|
124
|
-
value.map { |item| extract_value(item, remaining_path) }
|
119
|
+
# Process each object in the array separately
|
120
|
+
value.map { |item| extract_value(item, remaining_path) }
|
125
121
|
else
|
126
|
-
# Continue traversing the path
|
127
122
|
extract_value(value, remaining_path)
|
128
123
|
end
|
129
124
|
when Array
|
130
125
|
if current_part[:array]
|
131
126
|
# Map through array elements with remaining path
|
132
|
-
data.map { |item| extract_value(item, remaining_path) }
|
127
|
+
data.map { |item| extract_value(item, remaining_path) }
|
133
128
|
else
|
134
129
|
# Try to extract from each array element with the full path
|
135
|
-
|
136
|
-
result.empty? ? nil : result
|
130
|
+
data.map { |item| extract_value(item, path_parts) }
|
137
131
|
end
|
138
132
|
else
|
139
|
-
# For scalar values, return only if we're at the end of the path
|
140
133
|
remaining_path.empty? ? data : nil
|
141
134
|
end
|
142
135
|
end
|
@@ -152,26 +145,32 @@ module Verquest
|
|
152
145
|
|
153
146
|
current_part = path_parts.first
|
154
147
|
remaining_path = path_parts[1..]
|
155
|
-
key = current_part[:key].to_s
|
148
|
+
key = current_part[:key].to_s
|
149
|
+
|
150
|
+
if value.nil?
|
151
|
+
# Skip setting nil values
|
152
|
+
return result
|
153
|
+
end
|
156
154
|
|
157
155
|
if remaining_path.empty?
|
158
|
-
# End of path, set the value directly
|
159
156
|
result[key] = value
|
160
157
|
elsif current_part[:array] && value.is_a?(Array)
|
161
|
-
# Handle array notation in target path
|
162
158
|
result[key] ||= []
|
163
|
-
|
164
|
-
# Process each value in the array
|
165
159
|
value.each_with_index do |v, i|
|
160
|
+
next if v.nil? # Skip nil items in array
|
166
161
|
result[key][i] ||= {}
|
167
162
|
set_value(result[key][i], remaining_path, v)
|
163
|
+
# Remove keys with nil values from each object
|
164
|
+
result[key][i].delete_if { |_, val| val.nil? }
|
168
165
|
end
|
166
|
+
# Remove nils and compact the array
|
167
|
+
result[key] = result[key].compact
|
169
168
|
else
|
170
|
-
# Continue building nested structure
|
171
169
|
result[key] ||= {}
|
172
170
|
set_value(result[key], remaining_path, value)
|
171
|
+
# Remove keys with nil values from nested object
|
172
|
+
result[key].delete_if { |_, val| val.nil? }
|
173
173
|
end
|
174
|
-
|
175
174
|
result
|
176
175
|
end
|
177
176
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verquest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petr Hlavicka
|
@@ -76,13 +76,13 @@ files:
|
|
76
76
|
- lib/verquest/version.rb
|
77
77
|
- lib/verquest/version_resolver.rb
|
78
78
|
- lib/verquest/versions.rb
|
79
|
-
homepage: https://github.com/
|
79
|
+
homepage: https://github.com/verquest/verquest
|
80
80
|
licenses:
|
81
81
|
- MIT
|
82
82
|
metadata:
|
83
|
-
homepage_uri: https://github.com/
|
84
|
-
source_code_uri: https://github.com/
|
85
|
-
changelog_uri: https://github.com/
|
83
|
+
homepage_uri: https://github.com/verquest/verquest
|
84
|
+
source_code_uri: https://github.com/verquest/verquest
|
85
|
+
changelog_uri: https://github.com/verquest/verquest/blob/main/CHANGELOG.md
|
86
86
|
rdoc_options: []
|
87
87
|
require_paths:
|
88
88
|
- lib
|