lutaml-hal 0.1.8 → 0.1.9
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/README.adoc +1 -1
- data/lib/lutaml/hal/link.rb +7 -1
- data/lib/lutaml/hal/model_register.rb +6 -1
- data/lib/lutaml/hal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3193d7b68f48f5930b5247d0b962ed31fc39f5280b171084bd1ef36ffd2ff6b5
|
4
|
+
data.tar.gz: 8cc11026dfbe93ab84546cf2e358d8a14fd9e71acef677675201bf1e288bdcb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f583829974459e7edbeadfa3a4bca22b616a7e2b02afba0171159728c612265a1147dc7a32ac4677e798eec1129377b3bcba74ce8f24262590c5ac060453e7
|
7
|
+
data.tar.gz: 46e96d2f8d1ca38a7c71d48280046d2765749acc19877b2628305d7de4c6949dbcb0512933343ea68453d44e052ac6553d18e051839d23cb50d17fbb6075ece3
|
data/README.adoc
CHANGED
@@ -126,7 +126,7 @@ For detailed documentation, see these comprehensive guides:
|
|
126
126
|
URL patterns and path matching examples
|
127
127
|
|
128
128
|
* **link:docs/embedded-resources.adoc[Embedded resources]** - Implementing and
|
129
|
-
using embedded resources in HAL APIs
|
129
|
+
using embedded resources in HAL APIs with automatic link realization
|
130
130
|
|
131
131
|
|
132
132
|
=== Architecture overview
|
data/lib/lutaml/hal/link.rb
CHANGED
@@ -11,6 +11,9 @@ module Lutaml
|
|
11
11
|
# will be used to resolve unless overriden in resource#realize()
|
12
12
|
attr_accessor Hal::REGISTER_ID_ATTR_NAME.to_sym
|
13
13
|
|
14
|
+
# Store reference to parent resource for automatic embedded content detection
|
15
|
+
attr_accessor :parent_resource
|
16
|
+
|
14
17
|
attribute :href, :string
|
15
18
|
attribute :title, :string
|
16
19
|
attribute :name, :string
|
@@ -25,8 +28,11 @@ module Lutaml
|
|
25
28
|
# If the Link does not have a register, a register needs to be provided explicitly
|
26
29
|
# via the `register:` parameter.
|
27
30
|
def realize(register: nil, parent_resource: nil)
|
31
|
+
# Use provided parent_resource or fall back to stored parent_resource
|
32
|
+
effective_parent = parent_resource || @parent_resource
|
33
|
+
|
28
34
|
# First check if embedded content is available
|
29
|
-
if
|
35
|
+
if effective_parent && (embedded_content = check_embedded_content(effective_parent, register))
|
30
36
|
return embedded_content
|
31
37
|
end
|
32
38
|
|
@@ -134,7 +134,12 @@ module Lutaml
|
|
134
134
|
|
135
135
|
# Handle both array and single values with the same logic
|
136
136
|
values = value.is_a?(Array) ? value : [value]
|
137
|
-
values.each
|
137
|
+
values.each do |item|
|
138
|
+
mark_model_links_with_register(item)
|
139
|
+
|
140
|
+
# If this is a Link, set the parent resource for automatic embedded content detection
|
141
|
+
item.parent_resource = inspecting_model if item.is_a?(Lutaml::Hal::Link)
|
142
|
+
end
|
138
143
|
end
|
139
144
|
|
140
145
|
inspecting_model
|
data/lib/lutaml/hal/version.rb
CHANGED