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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4296cdc53ac951e9dabd94e87350ea4d82e7691fcd879e5ea38d9ac619c620e
4
- data.tar.gz: a9e1191c508dabc0bc942e86b210f06d4c27815ab10cf5fbdc322bbde0b59f68
3
+ metadata.gz: 17d40234cd89518b6025cc5a7fb3fd528a2664f9e46928391141de6d6d190ca7
4
+ data.tar.gz: e74a794d5b769ef44809db6522967e697da1d84d3ef57eded7a7878a920f7d38
5
5
  SHA512:
6
- metadata.gz: 2d69274700a75e1756c82103c095a0bf3b5b56fb0c9d9c35da98112afcbca422e37cfed00d46579f0969fec4392ae04b993f57e58f1aaea35e513d6ae39577ff
7
- data.tar.gz: 7ffa3d40825726c740a29cac23685e32aff7f4295603634361524305b7579bbf4b02194582b78f12da42c6923657c682b7182d863b08bbd9267ce3190bef6149
6
+ metadata.gz: 0e4ef4980e59697d4089eae07c8f5bddf3019f02d25c9b73a4981937cf2fc1efa2c07a14e63251e59d044390ae7871b6f0d481c8eda16030a6529bdac18bc97a
7
+ data.tar.gz: 3495e42fa5fc29c2bb01682c4aa28e1bdb111459069b22a2d16a07bd92446b7367c5161ec848a36308a8b5645ec32e4071a63798a96ed87875225d1c12264e8b
@@ -38,7 +38,7 @@ module Lutaml
38
38
  end
39
39
 
40
40
  def include_schema(schema_location)
41
- return unless location? || schema_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)
@@ -19,7 +19,7 @@ module Lutaml
19
19
  end
20
20
 
21
21
  def fetch_schema
22
- Glob.include_schema(schema_path) if schema_path
22
+ Glob.include_schema(schema_path) if schema_path && Glob.location?
23
23
  end
24
24
  end
25
25
  end
@@ -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.imports.each_with_index do |imported_schema, index|
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
- annotation_key = schema.keys.find { |key| key.include?("annotation") }
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(schema[annotation_key], :xml)
139
+ instance.annotation = Annotation.apply_mappings(elements[annotation_key], :xml)
136
140
  end
137
141
 
138
142
  class << self
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Xsd
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.1"
6
6
  end
7
7
  end
data/lutaml-xsd.gemspec CHANGED
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
34
34
 
35
- spec.add_dependency "lutaml-model", "~> 0.3"
35
+ spec.add_dependency "lutaml-model", "~> 0.5"
36
36
  spec.add_dependency "zeitwerk"
37
37
  end
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.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: 2024-12-31 00:00:00.000000000 Z
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.3'
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.3'
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: []