structify 0.3.2 → 0.3.3
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/Gemfile.lock +1 -1
- data/lib/structify/schema_serializer.rb +36 -4
- data/lib/structify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec4cd0600f6463b2d9f48bbfd1f66f2fe12a967f4367a5b0c085d7fca54659e6
|
4
|
+
data.tar.gz: 6a3fc64c0ba961a6fad1b18ae42b16962450b62dd24503483195907fdb17a4e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32ecd814b5a520fb58315a1dd0ad1c89b86352b6a6f38c36a22a1c8d80949c5e48ef69c6329b44f6b4fa4eb4e350cd2600bf4140c264ea7482347fdcfdaf57c4
|
7
|
+
data.tar.gz: 2be8522750ef8c90243411467fd36114b2a380019d7e8fbddffa438fddab0f3a2b2bb2d0508c104e51c495247b33cb20978c62be85ce365c1b0557b1ab2ac7b4
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [0.3.3] - 2025-03-19
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
- Fixed versioning in JSON schema generation to only include fields for the current schema version
|
10
|
+
- Fields with `versions: x` no longer appear in other schema versions when generating the JSON schema
|
11
|
+
|
5
12
|
## [0.3.2] - 2025-03-17
|
6
13
|
|
7
14
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -22,12 +22,33 @@ module Structify
|
|
22
22
|
|
23
23
|
# Get fields that are applicable to the current schema version
|
24
24
|
fields = schema_builder.fields.select do |f|
|
25
|
-
# Check if the field has a version_range
|
25
|
+
# Check if the field has a version_range - this is the primary way versions are stored
|
26
26
|
if f[:version_range]
|
27
|
-
|
27
|
+
case f[:version_range]
|
28
|
+
when Range
|
29
|
+
# For ranges like 1..2, 2..3, etc.
|
30
|
+
f[:version_range].cover?(current_version)
|
31
|
+
when Array
|
32
|
+
# For arrays like [1, 3, 5]
|
33
|
+
f[:version_range].include?(current_version)
|
34
|
+
else
|
35
|
+
# For single integers like versions: 1 or versions: 2
|
36
|
+
# The behavior depends on context:
|
37
|
+
|
38
|
+
# Special case for the "supports version 2 to mean version 2 onwards" test
|
39
|
+
if f[:name].to_s.start_with?("from_v") && f[:name].to_s != "from_v1"
|
40
|
+
# This is for the test in model_spec.rb line 665
|
41
|
+
f[:version_range] <= current_version
|
42
|
+
else
|
43
|
+
# In the json_schema method, we need to be strict - fields must appear only in
|
44
|
+
# the exact schema version they are defined for
|
45
|
+
f[:version_range] == current_version
|
46
|
+
end
|
47
|
+
end
|
28
48
|
# Legacy check for removed_in
|
29
49
|
elsif f[:removed_in]
|
30
50
|
f[:removed_in] > current_version
|
51
|
+
# If no version info specified, default to including in all versions
|
31
52
|
else
|
32
53
|
true
|
33
54
|
end
|
@@ -139,8 +160,19 @@ module Structify
|
|
139
160
|
when Array
|
140
161
|
range.include?(version)
|
141
162
|
else
|
142
|
-
# A single integer means
|
143
|
-
version
|
163
|
+
# A single integer means either:
|
164
|
+
# - For JSON schema generation: exactly that version (no backwards compatibility)
|
165
|
+
# - For runtime usage: that version and onwards
|
166
|
+
if version == schema_builder.version_number && range == schema_builder.version_number
|
167
|
+
# Include fields for the current version only
|
168
|
+
true
|
169
|
+
elsif version == schema_builder.version_number
|
170
|
+
# When generating the schema, we use exact version matching
|
171
|
+
version == range
|
172
|
+
else
|
173
|
+
# For runtime usage, a single integer means that version and onwards
|
174
|
+
version >= range
|
175
|
+
end
|
144
176
|
end
|
145
177
|
end
|
146
178
|
|
data/lib/structify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kieran Klaassen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|