lutaml 0.9.0 → 0.9.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: b4a5e17292ce48ecab9f02dfbc1ba4630fd8ccc8abbeef241830dba6751b21e3
4
- data.tar.gz: 82da115e0396750610178e711864546b19212f55a6a5119ce12464c0337a45a6
3
+ metadata.gz: c3bdc3f066879a36efeca4609e9aca838d50a6708a1112b403da3c67a2e1d4dc
4
+ data.tar.gz: '085cc25361b1aff8bd5ee4910230ceb5420a9830fbaeaa811b60c85b20de8f18'
5
5
  SHA512:
6
- metadata.gz: d07503ca2cdf8d33fb64f17dccf2eb0fefccbdc0853887713a8f62df1248799589b4cf5b017defbff2611f92563107bbc24f3a6a269d44775cad68a01e843c03
7
- data.tar.gz: '00392dc2b1a84f56343486d677c1494564d7ef46d26fc2d63eebc92ae29b0861488b812726a529a4d6f0b371e2bad72c1163912d6f0ea3752d6f0c26f02c9762'
6
+ metadata.gz: a29744b9dabc937dd635e33b93270a3cdbd28c3735fd8975fd459b0193e98db38cc6e15ad499185135294f4a8fcb10ce0f52c8ecade9ed9ad81dffef23e8245a
7
+ data.tar.gz: bbb498bc86c6752dfdbde5a54737cd522d20c2e04e4a6a1a59737c95b2c3c7600d452049412c6338a7dc028b0d33314f606a0fd3af98623e962ef68193d21f00
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.9.0".freeze
2
+ VERSION = "0.9.1".freeze
3
3
  end
@@ -57,10 +57,12 @@ module Lutaml
57
57
  # @return [Array<Hash>]
58
58
  # @note xpath ./packagedElement[@xmi:type="uml:Package"]
59
59
  def serialize_model_packages(model)
60
- model.packaged_element.map do |package|
60
+ model.packaged_element.select do |e|
61
+ e.type?("uml:Package")
62
+ end.map do |package|
61
63
  {
62
64
  xmi_id: package.id,
63
- name: package.name,
65
+ name: get_package_name(package),
64
66
  classes: serialize_model_classes(package, model),
65
67
  enums: serialize_model_enums(package),
66
68
  data_types: serialize_model_data_types(package),
@@ -72,6 +74,18 @@ module Lutaml
72
74
  end
73
75
  end
74
76
 
77
+ def get_package_name(package)
78
+ return package.name unless package.name.nil?
79
+
80
+ connector = fetch_connector(package.id)
81
+ if connector.target&.model && connector.target.model&.name
82
+ return "#{connector.target.model.name} " \
83
+ "(#{package.type.split(':').last})"
84
+ end
85
+
86
+ "unnamed"
87
+ end
88
+
75
89
  # @param package [Shale::Mapper]
76
90
  # @param model [Shale::Mapper]
77
91
  # @return [Array<Hash>]
@@ -164,7 +178,8 @@ module Lutaml
164
178
  matched_element = @xmi_root_model.extension.elements.element
165
179
  .find { |e| e.idref == xmi_id }
166
180
 
167
- return if !matched_element.links ||
181
+ return if !matched_element ||
182
+ !matched_element.links ||
168
183
  matched_element.links.association.empty?
169
184
 
170
185
  matched_element.links.association.map do |assoc|
data/lutaml.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency "parslet", "~> 2.0.0"
37
37
  spec.add_runtime_dependency "ruby-graphviz", "~> 1.2"
38
38
  spec.add_runtime_dependency "thor", "~> 1.0"
39
- spec.add_runtime_dependency "xmi"
39
+ spec.add_runtime_dependency "xmi", ">= 0.3.0"
40
40
 
41
41
  spec.add_development_dependency "byebug"
42
42
  spec.add_development_dependency "equivalent-xml", "~> 0.6.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-24 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expressir
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 0.3.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 0.3.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: byebug
127
127
  requirement: !ruby/object:Gem::Requirement