lutaml-model 0.8.1 → 0.8.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/.rubocop_todo.yml +9 -11
- data/lib/lutaml/json/adapter/multi_json_adapter.rb +4 -2
- data/lib/lutaml/json/adapter/oj_adapter.rb +4 -2
- data/lib/lutaml/key_value/adapter/json/multi_json_adapter.rb +4 -2
- data/lib/lutaml/key_value/adapter/json/oj_adapter.rb +4 -2
- data/lib/lutaml/model/mapping/listener.rb +4 -2
- data/lib/lutaml/model/services/base.rb +4 -2
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/xml/schema/xsd/schema_path.rb +6 -0
- data/lutaml-model.gemspec +0 -1
- data/spec/lutaml/xml/schema/xsd/glob_spec.rb +12 -0
- metadata +2 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ae1d87545b35bb4c5611ee8063e4ac7529f91b100b4505c7b2f2f8e0815ca07
|
|
4
|
+
data.tar.gz: 9c3784b872d6bfed995de44cfcde258c20f6c7004a6e0663332b44c1be653751
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0130ba36bc10f0fc1791433cd9d7ac7724920f2aa5023042aa4e24480d87cd75f342fc98510fc2dc3da67d67b491c8d0c07ce705819140c6ff989681dbf700e9
|
|
7
|
+
data.tar.gz: 0ddc770da4f35d7dffea4219f4663e5cbc56cd19d9ffd8b3396c8b7e7419a20c2491e84dfcc419de71a5b8fc1fbf43abb9d434a4c1d9f4878cc521e672ca65cd
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-05-03
|
|
3
|
+
# on 2026-05-03 22:38:22 UTC using RuboCop version 1.86.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -11,6 +11,14 @@ Gemspec/RequiredRubyVersion:
|
|
|
11
11
|
Exclude:
|
|
12
12
|
- 'lutaml-model.gemspec'
|
|
13
13
|
|
|
14
|
+
# Offense count: 2
|
|
15
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
16
|
+
# Configuration parameters: AllowForAlignment.
|
|
17
|
+
Layout/CommentIndentation:
|
|
18
|
+
Exclude:
|
|
19
|
+
- 'lib/lutaml/model/mapping/listener.rb'
|
|
20
|
+
- 'lib/lutaml/model/services/base.rb'
|
|
21
|
+
|
|
14
22
|
# Offense count: 3210
|
|
15
23
|
# This cop supports safe autocorrection (--autocorrect).
|
|
16
24
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
@@ -392,16 +400,6 @@ Security/MarshalLoad:
|
|
|
392
400
|
Exclude:
|
|
393
401
|
- 'scripts-xmi-profile/profile_xmi.rb'
|
|
394
402
|
|
|
395
|
-
# Offense count: 2
|
|
396
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
397
|
-
# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
|
|
398
|
-
# RedundantRestArgumentNames: args, arguments
|
|
399
|
-
# RedundantKeywordRestArgumentNames: kwargs, options, opts
|
|
400
|
-
# RedundantBlockArgumentNames: blk, block, proc
|
|
401
|
-
Style/ArgumentsForwarding:
|
|
402
|
-
Exclude:
|
|
403
|
-
- 'lib/lutaml/model/serialize.rb'
|
|
404
|
-
|
|
405
403
|
# Offense count: 1
|
|
406
404
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
407
405
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
@@ -16,7 +16,8 @@ module Lutaml
|
|
|
16
16
|
"multi_json gem is not available. Please add 'multi_json' to your Gemfile."
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# rubocop:disable Style/ArgumentsForwarding -- anonymous * requires Ruby 3.2+
|
|
20
|
+
def to_json(*args)
|
|
20
21
|
require "multi_json"
|
|
21
22
|
# Handle KeyValueElement input (new symmetric architecture)
|
|
22
23
|
attributes_to_serialize = if @attributes.is_a?(Lutaml::KeyValue::DataModel::Element)
|
|
@@ -27,7 +28,8 @@ module Lutaml
|
|
|
27
28
|
@attributes
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
MultiJson.dump(attributes_to_serialize, *)
|
|
31
|
+
MultiJson.dump(attributes_to_serialize, *args)
|
|
32
|
+
# rubocop:enable Style/ArgumentsForwarding
|
|
31
33
|
rescue LoadError
|
|
32
34
|
raise LoadError,
|
|
33
35
|
"multi_json gem is not available. Please add 'multi_json' to your Gemfile."
|
|
@@ -16,7 +16,8 @@ module Lutaml
|
|
|
16
16
|
"oj gem is not available. Please add 'oj' to your Gemfile or use the StandardAdapter."
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# rubocop:disable Style/ArgumentsForwarding -- anonymous * requires Ruby 3.2+
|
|
20
|
+
def to_json(*args)
|
|
20
21
|
require "oj"
|
|
21
22
|
# Handle KeyValueElement input (new symmetric architecture)
|
|
22
23
|
attributes_to_serialize = if @attributes.is_a?(Lutaml::KeyValue::DataModel::Element)
|
|
@@ -27,7 +28,8 @@ module Lutaml
|
|
|
27
28
|
@attributes
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
Oj.dump(attributes_to_serialize, *)
|
|
31
|
+
Oj.dump(attributes_to_serialize, *args)
|
|
32
|
+
# rubocop:enable Style/ArgumentsForwarding
|
|
31
33
|
rescue LoadError
|
|
32
34
|
raise LoadError,
|
|
33
35
|
"oj gem is not available. Please add 'oj' to your Gemfile or use the StandardAdapter."
|
|
@@ -20,7 +20,8 @@ module Lutaml
|
|
|
20
20
|
"multi_json gem is not available. Please add 'multi_json' to your Gemfile."
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
# rubocop:disable Style/ArgumentsForwarding -- anonymous * requires Ruby 3.2+
|
|
24
|
+
def to_json(*args)
|
|
24
25
|
require "multi_json"
|
|
25
26
|
# Handle KeyValueElement input (new symmetric architecture)
|
|
26
27
|
attributes_to_serialize = if @attributes.is_a?(Lutaml::KeyValue::DataModel::Element)
|
|
@@ -31,7 +32,8 @@ module Lutaml
|
|
|
31
32
|
@attributes
|
|
32
33
|
end
|
|
33
34
|
|
|
34
|
-
MultiJson.dump(attributes_to_serialize, *)
|
|
35
|
+
MultiJson.dump(attributes_to_serialize, *args)
|
|
36
|
+
# rubocop:enable Style/ArgumentsForwarding
|
|
35
37
|
rescue LoadError
|
|
36
38
|
raise LoadError,
|
|
37
39
|
"multi_json gem is not available. Please add 'multi_json' to your Gemfile."
|
|
@@ -20,7 +20,8 @@ module Lutaml
|
|
|
20
20
|
"oj gem is not available. Please add 'oj' to your Gemfile or use the StandardAdapter."
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
# rubocop:disable Style/ArgumentsForwarding -- anonymous * requires Ruby 3.2+
|
|
24
|
+
def to_json(*args)
|
|
24
25
|
require "oj"
|
|
25
26
|
# Handle KeyValueElement input (new symmetric architecture)
|
|
26
27
|
attributes_to_serialize = if @attributes.is_a?(Lutaml::KeyValue::DataModel::Element)
|
|
@@ -31,7 +32,8 @@ module Lutaml
|
|
|
31
32
|
@attributes
|
|
32
33
|
end
|
|
33
34
|
|
|
34
|
-
Oj.dump(attributes_to_serialize, *)
|
|
35
|
+
Oj.dump(attributes_to_serialize, *args)
|
|
36
|
+
# rubocop:enable Style/ArgumentsForwarding
|
|
35
37
|
rescue LoadError
|
|
36
38
|
raise LoadError,
|
|
37
39
|
"oj gem is not available. Please add 'oj' to your Gemfile or use the StandardAdapter."
|
|
@@ -91,13 +91,15 @@ module Lutaml
|
|
|
91
91
|
#
|
|
92
92
|
# @param args [Array] Arguments to pass to the handler block
|
|
93
93
|
# @return [Object] Result of the handler invocation
|
|
94
|
-
|
|
94
|
+
# rubocop:disable Style/ArgumentsForwarding -- anonymous * requires Ruby 3.2+
|
|
95
|
+
def call(*args)
|
|
95
96
|
if simple?
|
|
96
97
|
raise NoHandlerError,
|
|
97
98
|
"Cannot call simple listener #{id.inspect}"
|
|
98
99
|
end
|
|
99
100
|
|
|
100
|
-
@handler.call(*)
|
|
101
|
+
@handler.call(*args)
|
|
102
|
+
# rubocop:enable Style/ArgumentsForwarding
|
|
101
103
|
end
|
|
102
104
|
|
|
103
105
|
# Error raised when attempting to invoke a simple listener as a complex one.
|
|
@@ -2,8 +2,10 @@ module Lutaml
|
|
|
2
2
|
module Model
|
|
3
3
|
module Services
|
|
4
4
|
class Base
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
# rubocop:disable Style/ArgumentsForwarding -- anonymous * requires Ruby 3.2+
|
|
6
|
+
def self.call(*args)
|
|
7
|
+
new(*args).call
|
|
8
|
+
# rubocop:enable Style/ArgumentsForwarding
|
|
7
9
|
end
|
|
8
10
|
end
|
|
9
11
|
end
|
data/lib/lutaml/model/version.rb
CHANGED
|
@@ -34,6 +34,9 @@ module Lutaml
|
|
|
34
34
|
def include_schema(schema_location)
|
|
35
35
|
return unless schema_location
|
|
36
36
|
|
|
37
|
+
schema_location = schema_location.strip
|
|
38
|
+
return if schema_location.empty?
|
|
39
|
+
|
|
37
40
|
resolved_location = resolve_schema_location(schema_location)
|
|
38
41
|
if absolute_path?(resolved_location)
|
|
39
42
|
return read_absolute_path(
|
|
@@ -54,6 +57,9 @@ module Lutaml
|
|
|
54
57
|
end
|
|
55
58
|
|
|
56
59
|
def location_for(schema_location)
|
|
60
|
+
schema_location = schema_location&.strip
|
|
61
|
+
return nil if schema_location.nil? || schema_location.empty?
|
|
62
|
+
|
|
57
63
|
resolved_location = resolve_schema_location(schema_location)
|
|
58
64
|
return resolved_location if absolute_path?(resolved_location) || absolute_url?(resolved_location)
|
|
59
65
|
|
data/lutaml-model.gemspec
CHANGED
|
@@ -37,7 +37,6 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_dependency "concurrent-ruby"
|
|
38
38
|
spec.add_dependency "liquid", "~> 5.0"
|
|
39
39
|
spec.add_dependency "moxml", ">= 0.1.16"
|
|
40
|
-
spec.add_dependency "openssl", "~> 3.0"
|
|
41
40
|
spec.add_dependency "ostruct"
|
|
42
41
|
spec.add_dependency "rubyzip", "~> 2.3"
|
|
43
42
|
spec.add_dependency "thor"
|
|
@@ -194,6 +194,18 @@ RSpec.describe Lutaml::Xml::Schema::Xsd::Glob do
|
|
|
194
194
|
end
|
|
195
195
|
end
|
|
196
196
|
|
|
197
|
+
context "with whitespace in schemaLocation" do
|
|
198
|
+
it "strips leading/trailing whitespace from schema location" do
|
|
199
|
+
clean = described_class.include_schema("metaschema.xsd")
|
|
200
|
+
padded = described_class.include_schema(" metaschema.xsd ")
|
|
201
|
+
expect(padded).to eq(clean)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
it "handles whitespace-only schema location gracefully" do
|
|
205
|
+
expect(described_class.include_schema(" ")).to be_nil
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
197
209
|
context "with regex pattern mapping" do
|
|
198
210
|
before do
|
|
199
211
|
# Use forward slashes for cross-platform compatibility in regex patterns
|
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.
|
|
4
|
+
version: 0.8.3
|
|
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-05-
|
|
11
|
+
date: 2026-05-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -94,20 +94,6 @@ dependencies:
|
|
|
94
94
|
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: 0.1.16
|
|
97
|
-
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: openssl
|
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
|
100
|
-
requirements:
|
|
101
|
-
- - "~>"
|
|
102
|
-
- !ruby/object:Gem::Version
|
|
103
|
-
version: '3.0'
|
|
104
|
-
type: :runtime
|
|
105
|
-
prerelease: false
|
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - "~>"
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: '3.0'
|
|
111
97
|
- !ruby/object:Gem::Dependency
|
|
112
98
|
name: ostruct
|
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|