lutaml-xsd 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lutaml/xsd/glob.rb +1 -1
- data/lib/lutaml/xsd/import.rb +1 -1
- data/lib/lutaml/xsd/schema.rb +11 -7
- data/lib/lutaml/xsd/version.rb +1 -1
- data/lutaml-xsd.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17d40234cd89518b6025cc5a7fb3fd528a2664f9e46928391141de6d6d190ca7
|
4
|
+
data.tar.gz: e74a794d5b769ef44809db6522967e697da1d84d3ef57eded7a7878a920f7d38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e4ef4980e59697d4089eae07c8f5bddf3019f02d25c9b73a4981937cf2fc1efa2c07a14e63251e59d044390ae7871b6f0d481c8eda16030a6529bdac18bc97a
|
7
|
+
data.tar.gz: 3495e42fa5fc29c2bb01682c4aa28e1bdb111459069b22a2d16a07bd92446b7367c5161ec848a36308a8b5645ec32e4071a63798a96ed87875225d1c12264e8b
|
data/lib/lutaml/xsd/glob.rb
CHANGED
@@ -38,7 +38,7 @@ module Lutaml
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def include_schema(schema_location)
|
41
|
-
return unless location?
|
41
|
+
return unless location? && schema_location
|
42
42
|
|
43
43
|
schema_path = schema_location_path(schema_location)
|
44
44
|
url? ? http_get(schema_path) : File.read(schema_path)
|
data/lib/lutaml/xsd/import.rb
CHANGED
data/lib/lutaml/xsd/schema.rb
CHANGED
@@ -8,6 +8,7 @@ module Lutaml
|
|
8
8
|
attribute :lang, :string
|
9
9
|
attribute :xmlns, :string
|
10
10
|
attribute :version, :string
|
11
|
+
attribute :imported, :boolean
|
11
12
|
attribute :final_default, :string
|
12
13
|
attribute :block_default, :string
|
13
14
|
attribute :target_namespace, :string
|
@@ -56,14 +57,16 @@ module Lutaml
|
|
56
57
|
|
57
58
|
def import_from_schema(model, value)
|
58
59
|
value.each do |schema|
|
59
|
-
setup_import_and_include("import", model, schema, namespace: schema["namespace"])
|
60
|
+
setup_import_and_include("import", model, schema, namespace: schema["attributes"]["namespace"])
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
63
64
|
def import_to_schema(model, parent, _doc)
|
64
|
-
model.
|
65
|
+
return if model.imported
|
66
|
+
|
67
|
+
model.imported = true
|
68
|
+
model.imports.each do |imported_schema|
|
65
69
|
parent.add_child(imported_schema.to_xml)
|
66
|
-
model.imports.delete_at(index)
|
67
70
|
end
|
68
71
|
end
|
69
72
|
|
@@ -83,7 +86,7 @@ module Lutaml
|
|
83
86
|
private
|
84
87
|
|
85
88
|
def setup_import_and_include(klass, model, schema, args = {})
|
86
|
-
instance = init_instance_of(klass, schema, args)
|
89
|
+
instance = init_instance_of(klass, schema["attributes"] || {}, args)
|
87
90
|
annotation_object(instance, schema)
|
88
91
|
model.send("#{klass}s") << instance
|
89
92
|
schema_path = instance.schema_path
|
@@ -118,7 +121,7 @@ module Lutaml
|
|
118
121
|
|
119
122
|
def schema_by_location_or_instance(instance)
|
120
123
|
schema_path = instance.schema_path
|
121
|
-
return unless schema_path
|
124
|
+
return unless schema_path && Glob.location?
|
122
125
|
|
123
126
|
self.class.processed_schemas[schema_path] ||
|
124
127
|
Lutaml::Xsd.parse(
|
@@ -129,10 +132,11 @@ module Lutaml
|
|
129
132
|
end
|
130
133
|
|
131
134
|
def annotation_object(instance, schema)
|
132
|
-
|
135
|
+
elements = schema["elements"] || {}
|
136
|
+
annotation_key = elements.keys.find { |key| key.include?("annotation") }
|
133
137
|
return unless annotation_key
|
134
138
|
|
135
|
-
instance.annotation = Annotation.apply_mappings(
|
139
|
+
instance.annotation = Annotation.apply_mappings(elements[annotation_key], :xml)
|
136
140
|
end
|
137
141
|
|
138
142
|
class << self
|
data/lib/lutaml/xsd/version.rb
CHANGED
data/lutaml-xsd.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lutaml-xsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lutaml-model
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: zeitwerk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +117,7 @@ metadata:
|
|
117
117
|
source_code_uri: https://github.com/lutaml/expressir
|
118
118
|
changelog_uri: https://github.com/lutaml/lutaml-xsd/releases
|
119
119
|
rubygems_mfa_required: 'true'
|
120
|
-
post_install_message:
|
120
|
+
post_install_message:
|
121
121
|
rdoc_options: []
|
122
122
|
require_paths:
|
123
123
|
- lib
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubygems_version: 3.3.27
|
136
|
-
signing_key:
|
136
|
+
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Library for XML Schema Definition (XSD) files
|
139
139
|
test_files: []
|