xmi 0.5.4 → 0.5.6
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 +29 -47
- data/CLAUDE.md +166 -0
- data/README.adoc +9 -27
- data/TODO.perf/01-eliminate-duplicate-nokogiri-parse.md +33 -0
- data/TODO.perf/02-read-only-fast-mode.md +38 -0
- data/TODO.perf/03-register-fallback-idempotency.md +20 -0
- data/TODO.perf/04-pipeline-hash-mutation.md +31 -0
- data/TODO.perf/05-ea-root-single-parse.md +29 -0
- data/docs/migration.md +6 -6
- data/docs/versioning.md +1 -1
- data/lib/tasks/benchmark_runner.rb +1 -1
- data/lib/xmi/custom_profile/abstract.rb +16 -0
- data/lib/xmi/custom_profile/basic_doc.rb +16 -0
- data/lib/xmi/custom_profile/bibliography.rb +16 -0
- data/lib/xmi/custom_profile/edition.rb +18 -0
- data/lib/xmi/custom_profile/enumeration.rb +16 -0
- data/lib/xmi/custom_profile/informative.rb +16 -0
- data/lib/xmi/custom_profile/invariant.rb +16 -0
- data/lib/xmi/custom_profile/number.rb +18 -0
- data/lib/xmi/custom_profile/ocl.rb +16 -0
- data/lib/xmi/custom_profile/persistence.rb +20 -0
- data/lib/xmi/custom_profile/publication_date.rb +18 -0
- data/lib/xmi/custom_profile/year_version.rb +18 -0
- data/lib/xmi/custom_profile.rb +12 -143
- data/lib/xmi/ea_root/code_generation.rb +140 -0
- data/lib/xmi/ea_root/extension_lifecycle.rb +52 -0
- data/lib/xmi/ea_root/namespace_handling.rb +39 -0
- data/lib/xmi/ea_root/xml_parsing.rb +51 -0
- data/lib/xmi/ea_root.rb +14 -407
- data/lib/xmi/namespace_detector.rb +35 -3
- data/lib/xmi/parser_pipeline.rb +9 -9
- data/lib/xmi/sparx/index.rb +2 -2
- data/lib/xmi/sparx/mappings/base_mapping.rb +4 -4
- data/lib/xmi/sparx/mappings.rb +1 -1
- data/lib/xmi/sparx/root.rb +3 -3
- data/lib/xmi/sparx.rb +2 -2
- data/lib/xmi/version.rb +1 -1
- data/lib/xmi/version_registry.rb +11 -8
- metadata +24 -2
data/lib/xmi/version_registry.rb
CHANGED
|
@@ -108,16 +108,15 @@ module Xmi
|
|
|
108
108
|
#
|
|
109
109
|
# @param xml_content [String] XML content
|
|
110
110
|
# @param model_class [Class] The model class to parse into
|
|
111
|
+
# @param opts [Hash] Options passed through to from_xml
|
|
112
|
+
# (e.g., import_declaration_plan: :skip)
|
|
111
113
|
# @return [Object] Parsed model instance
|
|
112
|
-
def parse_with_detected_version(xml_content, model_class)
|
|
114
|
+
def parse_with_detected_version(xml_content, model_class, **opts)
|
|
113
115
|
register = detect_register(xml_content)
|
|
114
116
|
|
|
115
|
-
if register
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
# Fallback to default parsing (existing behavior)
|
|
119
|
-
model_class.from_xml(xml_content)
|
|
120
|
-
end
|
|
117
|
+
opts[:register] = register if register
|
|
118
|
+
|
|
119
|
+
model_class.from_xml(xml_content, **opts)
|
|
121
120
|
end
|
|
122
121
|
|
|
123
122
|
# Handle mixed namespace documents by binding additional namespace URIs
|
|
@@ -159,7 +158,11 @@ module Xmi
|
|
|
159
158
|
# A cycle would occur if reg's fallback chain includes primary_register.
|
|
160
159
|
# We check this by seeing if primary_register.id appears in reg's fallback.
|
|
161
160
|
# Use add_fallback to keep Register and TypeContext in sync and invalidate caches.
|
|
162
|
-
|
|
161
|
+
# Guard: skip if primary already has this fallback to avoid unnecessary cache invalidation.
|
|
162
|
+
unless primary_register.fallback.include?(reg.id) ||
|
|
163
|
+
reg.fallback.include?(primary_register.id)
|
|
164
|
+
primary_register.add_fallback(reg.id)
|
|
165
|
+
end
|
|
163
166
|
end
|
|
164
167
|
end
|
|
165
168
|
# rubocop:enable Metrics/CyclomaticComplexity
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xmi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.6
|
|
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-04-
|
|
11
|
+
date: 2026-04-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|
|
@@ -52,10 +52,16 @@ files:
|
|
|
52
52
|
- ".rubocop.yml"
|
|
53
53
|
- ".rubocop_todo.yml"
|
|
54
54
|
- CHANGELOG.md
|
|
55
|
+
- CLAUDE.md
|
|
55
56
|
- CODE_OF_CONDUCT.md
|
|
56
57
|
- Gemfile
|
|
57
58
|
- README.adoc
|
|
58
59
|
- Rakefile
|
|
60
|
+
- TODO.perf/01-eliminate-duplicate-nokogiri-parse.md
|
|
61
|
+
- TODO.perf/02-read-only-fast-mode.md
|
|
62
|
+
- TODO.perf/03-register-fallback-idempotency.md
|
|
63
|
+
- TODO.perf/04-pipeline-hash-mutation.md
|
|
64
|
+
- TODO.perf/05-ea-root-single-parse.md
|
|
59
65
|
- bin/console
|
|
60
66
|
- bin/setup
|
|
61
67
|
- docs/migration.md
|
|
@@ -67,10 +73,26 @@ files:
|
|
|
67
73
|
- lib/xmi.rb
|
|
68
74
|
- lib/xmi/add.rb
|
|
69
75
|
- lib/xmi/custom_profile.rb
|
|
76
|
+
- lib/xmi/custom_profile/abstract.rb
|
|
77
|
+
- lib/xmi/custom_profile/basic_doc.rb
|
|
78
|
+
- lib/xmi/custom_profile/bibliography.rb
|
|
79
|
+
- lib/xmi/custom_profile/edition.rb
|
|
80
|
+
- lib/xmi/custom_profile/enumeration.rb
|
|
81
|
+
- lib/xmi/custom_profile/informative.rb
|
|
82
|
+
- lib/xmi/custom_profile/invariant.rb
|
|
83
|
+
- lib/xmi/custom_profile/number.rb
|
|
84
|
+
- lib/xmi/custom_profile/ocl.rb
|
|
85
|
+
- lib/xmi/custom_profile/persistence.rb
|
|
86
|
+
- lib/xmi/custom_profile/publication_date.rb
|
|
87
|
+
- lib/xmi/custom_profile/year_version.rb
|
|
70
88
|
- lib/xmi/delete.rb
|
|
71
89
|
- lib/xmi/difference.rb
|
|
72
90
|
- lib/xmi/documentation.rb
|
|
73
91
|
- lib/xmi/ea_root.rb
|
|
92
|
+
- lib/xmi/ea_root/code_generation.rb
|
|
93
|
+
- lib/xmi/ea_root/extension_lifecycle.rb
|
|
94
|
+
- lib/xmi/ea_root/namespace_handling.rb
|
|
95
|
+
- lib/xmi/ea_root/xml_parsing.rb
|
|
74
96
|
- lib/xmi/extension.rb
|
|
75
97
|
- lib/xmi/namespace.rb
|
|
76
98
|
- lib/xmi/namespace/dynamic.rb
|