lutaml-model 0.8.145 → 0.8.146

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d4a991baea8734712513f2d1ffb0025d0a5867f174a40b32bee58b1be5017c5
4
- data.tar.gz: f1713d5b0ef5024da66ee23f8251604da86fd3f8d7035e7f64118bf080ea9128
3
+ metadata.gz: 8c23c8811a30181e0ed6ca3987a23ab7fadf4c4354ca143d28e84114218f80af
4
+ data.tar.gz: aa89d32438cae623a9e0dd37bd8e614bcdd76bf53759e164b47f44eb957f7a96
5
5
  SHA512:
6
- metadata.gz: db827973c88ea9fe1779a0105d18ef1d0f93868fa4a59147a029c504005ec5f5e50378a7f90c490097e24d20c62fb33531a8fe277fb7620ed3cd17debdd2adaf
7
- data.tar.gz: 90045bda2ce6c2605ca3708527c44ad7811cacb6cb8d4f72d83f3a875a3a043a84503dc48f24f716d94f5e92e367d6a4bfb2fa556982d14db65125623d885252
6
+ metadata.gz: 3dd2402033dbecea612e3bb32903d041d466d71408cbda93159dedc5af884f24a0b49e6501874481bc92184b6179d996f388bcee0811f9b7758c9361a593f68c
7
+ data.tar.gz: 5109ea9359e823c2ace26967168222d01d0da81390e838b77c0445cc29ee295aa173fbdb938067eacd4353a457080e78df13c88df568cb0118e28da6ada77563
@@ -17,7 +17,7 @@ module Lutaml
17
17
 
18
18
  begin
19
19
  results << YAML.safe_load(yaml, aliases: true)
20
- rescue Psych::SyntaxError => e
20
+ rescue *Lutaml::Model::Utils.yaml_parse_errors => e
21
21
  warn "Skipping invalid yaml: #{e.message}"
22
22
  end
23
23
  end
@@ -34,6 +34,17 @@ module Lutaml
34
34
  false
35
35
  end
36
36
 
37
+ # Parse-error classes of every YAML engine that may be answering
38
+ # ::YAML in this process. A host bundle can rebind ::YAML (a
39
+ # Psych drop-in), so the multi-document skip-rescues must cover
40
+ # each loaded engine's parse error, not only Psych's (#1053: a
41
+ # raw Yeptris::ParseError escaped from_yamls).
42
+ def yaml_parse_errors
43
+ errors = [Psych::SyntaxError]
44
+ errors << Yeptris::ParseError if defined?(Yeptris::ParseError)
45
+ errors
46
+ end
47
+
37
48
  # Convert string to camel case (cached)
38
49
  def camel_case(str)
39
50
  return "" if str.nil? || str.empty?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.145"
5
+ VERSION = "0.8.146"
6
6
  end
7
7
  end
@@ -22,7 +22,7 @@ module Lutaml
22
22
  end
23
23
 
24
24
  results
25
- rescue Psych::SyntaxError => e
25
+ rescue *Lutaml::Model::Utils.yaml_parse_errors => e
26
26
  warn "Skipping invalid yaml: #{e.message}"
27
27
  parse_with_split(yamls)
28
28
  end
@@ -36,7 +36,7 @@ module Lutaml
36
36
  begin
37
37
  doc = YAML.safe_load(yaml, aliases: true)
38
38
  results << doc unless doc.nil?
39
- rescue Psych::SyntaxError => e
39
+ rescue *Lutaml::Model::Utils.yaml_parse_errors => e
40
40
  warn "Skipping invalid yaml: #{e.message}"
41
41
  end
42
42
  end
@@ -154,6 +154,38 @@ RSpec.describe "Yamls" do
154
154
  end.to output(/Skipping invalid yaml: /).to_stderr
155
155
  end
156
156
 
157
+ # #1053: a host bundle can rebind ::YAML to another engine (a Psych
158
+ # drop-in), so the multi-doc lane must treat every loaded engine's
159
+ # parse error as a skippable document error — never let a raw engine
160
+ # error escape.
161
+ describe "engine parse errors" do
162
+ it "rescues every loaded YAML engine's parse errors" do
163
+ errors = Lutaml::Model::Utils.yaml_parse_errors
164
+
165
+ expect(errors).to include(Psych::SyntaxError)
166
+ if defined?(Yeptris::ParseError)
167
+ expect(errors).to include(Yeptris::ParseError)
168
+ end
169
+ end
170
+
171
+ it "skips an invalid document when the active engine raises its own parse error" do
172
+ skip "yeptris not loadable in this process" unless Lutaml::Model::Utils.safe_load("yeptris", :Yeptris)
173
+
174
+ allow(YAML).to receive(:load_stream).and_raise(
175
+ Yeptris::ParseError.new("parse failed: unexpected parser state at line 11, column 26"),
176
+ )
177
+
178
+ expect do
179
+ expect(Lutaml::Yamls::Adapter::StandardAdapter.parse(invalid_yamls_content)).to eq(
180
+ [
181
+ { "full_name" => "John", "age" => 30, "address" => { "city" => "New York" } },
182
+ { "full_name" => "Bob", "age" => 35, "address" => { "city" => "Paris" } },
183
+ ],
184
+ )
185
+ end.to output(/Skipping invalid yaml: /).to_stderr
186
+ end
187
+ end
188
+
157
189
  describe "parsing" do
158
190
  it "handles empty documents" do
159
191
  yamls_with_empty_docs = <<~YAMLS
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.145
4
+ version: 0.8.146
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-28 00:00:00.000000000 Z
11
+ date: 2026-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64