lutaml-model 0.5.3 → 0.5.4

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-tests.yml +2 -0
  3. data/.rubocop_todo.yml +39 -13
  4. data/Gemfile +1 -0
  5. data/README.adoc +396 -23
  6. data/lib/lutaml/model/constants.rb +7 -0
  7. data/lib/lutaml/model/error/type/invalid_value_error.rb +19 -0
  8. data/lib/lutaml/model/error.rb +1 -0
  9. data/lib/lutaml/model/key_value_mapping.rb +31 -2
  10. data/lib/lutaml/model/mapping_hash.rb +8 -0
  11. data/lib/lutaml/model/mapping_rule.rb +4 -0
  12. data/lib/lutaml/model/schema/templates/simple_type.rb +247 -0
  13. data/lib/lutaml/model/schema/xml_compiler.rb +720 -0
  14. data/lib/lutaml/model/schema.rb +5 -0
  15. data/lib/lutaml/model/serialize.rb +24 -8
  16. data/lib/lutaml/model/toml_adapter/toml_rb_adapter.rb +1 -2
  17. data/lib/lutaml/model/type/hash.rb +11 -11
  18. data/lib/lutaml/model/version.rb +1 -1
  19. data/lib/lutaml/model/xml_adapter/nokogiri_adapter.rb +5 -1
  20. data/lib/lutaml/model/xml_adapter/xml_document.rb +11 -15
  21. data/lib/lutaml/model/xml_mapping.rb +4 -2
  22. data/lib/lutaml/model/xml_mapping_rule.rb +1 -4
  23. data/lib/lutaml/model.rb +1 -0
  24. data/spec/fixtures/xml/invalid_math_document.xml +4 -0
  25. data/spec/fixtures/xml/math_document_schema.xsd +56 -0
  26. data/spec/fixtures/xml/test_schema.xsd +53 -0
  27. data/spec/fixtures/xml/valid_math_document.xml +4 -0
  28. data/spec/lutaml/model/cdata_spec.rb +2 -2
  29. data/spec/lutaml/model/custom_model_spec.rb +7 -20
  30. data/spec/lutaml/model/key_value_mapping_spec.rb +27 -0
  31. data/spec/lutaml/model/map_all_spec.rb +188 -0
  32. data/spec/lutaml/model/mixed_content_spec.rb +15 -15
  33. data/spec/lutaml/model/schema/xml_compiler_spec.rb +1431 -0
  34. data/spec/lutaml/model/with_child_mapping_spec.rb +2 -2
  35. data/spec/lutaml/model/xml_adapter/xml_namespace_spec.rb +52 -0
  36. data/spec/lutaml/model/xml_mapping_spec.rb +108 -1
  37. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75da66a7985ef5c93b6c5f93a660046026a158b85a422cf924ce7a641f57d488
4
- data.tar.gz: 5b3cbb99bd8c4398dec561c3885c2d996dd0491a0ba44d074549cc09c55cb59b
3
+ metadata.gz: 017de0dd3f1a97bc4fae79b00457e0f21fb8fc6c716de96224234a50344ca293
4
+ data.tar.gz: ccdd5e4db10c87afd282feec45b13bc94ec8eeefa253fa5b0935cf9908eb1510
5
5
  SHA512:
6
- metadata.gz: '04728da10c80f08e47645646f4f06bbc796b074f8f1941594574f1d69fee96c32882b3db69d02b2f7878822b84423a46c81bb8a5ebb118d5b9c97533c0553e46'
7
- data.tar.gz: 06cc0fcbb12ea5fc260eb25b3ecf3c5fc204738df760c5e33468b285007a4c0f0bd955e00ce1c128267c11f97d943f9a1f24b55c3a799ff3d730d0453c602bd8
6
+ metadata.gz: 4bf32563b65d3832fbd8b56b49457ffa73e8021029ec3dfb040c46bd9b3a7efb75f3f7bb848c9ce9a30e6a00d41b96c190f408c228a43d0cb20cfdef21817eb2
7
+ data.tar.gz: d010cb985aa94803c318aad8319fd6a972ff419f11e5b7ee52a6d2aca43587d60c2561161427d1eaad7d7a2af36fe5c981817dbc89302557bb16775819384a93
@@ -12,3 +12,5 @@ on:
12
12
  jobs:
13
13
  rake:
14
14
  uses: metanorma/ci/.github/workflows/dependent-rake.yml@main
15
+ with:
16
+ command: bundle exec rspec
data/.rubocop_todo.yml CHANGED
@@ -1,12 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-01-07 10:19:56 UTC using RuboCop version 1.69.2.
3
+ # on 2025-01-14 02:47:56 UTC using RuboCop version 1.69.2.
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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 292
9
+ # Offense count: 522
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
11
  # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
12
12
  # URISchemes: http, https
@@ -31,14 +31,16 @@ Lint/DuplicateMethods:
31
31
  Exclude:
32
32
  - 'lib/lutaml/model/type/float.rb'
33
33
 
34
- # Offense count: 40
34
+ # Offense count: 54
35
35
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
36
36
  Metrics/AbcSize:
37
37
  Exclude:
38
38
  - 'lib/lutaml/model/attribute.rb'
39
39
  - 'lib/lutaml/model/comparable_model.rb'
40
+ - 'lib/lutaml/model/key_value_mapping.rb'
40
41
  - 'lib/lutaml/model/mapping_rule.rb'
41
42
  - 'lib/lutaml/model/schema/relaxng_schema.rb'
43
+ - 'lib/lutaml/model/schema/xml_compiler.rb'
42
44
  - 'lib/lutaml/model/schema/xsd_schema.rb'
43
45
  - 'lib/lutaml/model/serialize.rb'
44
46
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
@@ -49,18 +51,20 @@ Metrics/AbcSize:
49
51
  - 'lib/lutaml/model/xml_mapping.rb'
50
52
  - 'lib/lutaml/model/xml_mapping_rule.rb'
51
53
 
52
- # Offense count: 9
54
+ # Offense count: 12
53
55
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
54
56
  # AllowedMethods: refine
55
57
  Metrics/BlockLength:
56
58
  Max: 46
57
59
 
58
- # Offense count: 32
60
+ # Offense count: 48
59
61
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
60
62
  Metrics/CyclomaticComplexity:
61
63
  Exclude:
62
64
  - 'lib/lutaml/model/attribute.rb'
63
65
  - 'lib/lutaml/model/comparable_model.rb'
66
+ - 'lib/lutaml/model/key_value_mapping.rb'
67
+ - 'lib/lutaml/model/schema/xml_compiler.rb'
64
68
  - 'lib/lutaml/model/serialize.rb'
65
69
  - 'lib/lutaml/model/type/integer.rb'
66
70
  - 'lib/lutaml/model/xml_adapter/builder/oga.rb'
@@ -69,7 +73,7 @@ Metrics/CyclomaticComplexity:
69
73
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
70
74
  - 'lib/lutaml/model/xml_adapter/xml_document.rb'
71
75
 
72
- # Offense count: 63
76
+ # Offense count: 83
73
77
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
74
78
  Metrics/MethodLength:
75
79
  Max: 45
@@ -77,14 +81,16 @@ Metrics/MethodLength:
77
81
  # Offense count: 7
78
82
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
79
83
  Metrics/ParameterLists:
80
- Max: 15
84
+ Max: 14
81
85
 
82
- # Offense count: 30
86
+ # Offense count: 38
83
87
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
84
88
  Metrics/PerceivedComplexity:
85
89
  Exclude:
86
90
  - 'lib/lutaml/model/attribute.rb'
87
91
  - 'lib/lutaml/model/comparable_model.rb'
92
+ - 'lib/lutaml/model/key_value_mapping.rb'
93
+ - 'lib/lutaml/model/schema/xml_compiler.rb'
88
94
  - 'lib/lutaml/model/serialize.rb'
89
95
  - 'lib/lutaml/model/type/integer.rb'
90
96
  - 'lib/lutaml/model/xml_adapter/builder/oga.rb'
@@ -110,7 +116,7 @@ RSpec/ContextWording:
110
116
  - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
111
117
  - 'spec/lutaml/model/xml_mapping_spec.rb'
112
118
 
113
- # Offense count: 1
119
+ # Offense count: 2
114
120
  # This cop supports unsafe autocorrection (--autocorrect-all).
115
121
  # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
116
122
  # SupportedStyles: described_class, explicit
@@ -118,7 +124,7 @@ RSpec/DescribedClass:
118
124
  Exclude:
119
125
  - 'spec/lutaml/model/xml_mapping_spec.rb'
120
126
 
121
- # Offense count: 139
127
+ # Offense count: 146
122
128
  # Configuration parameters: CountAsOne.
123
129
  RSpec/ExampleLength:
124
130
  Max: 54
@@ -148,16 +154,16 @@ RSpec/MultipleDescribes:
148
154
  - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
149
155
  - 'spec/lutaml/model/xml_adapter_spec.rb'
150
156
 
151
- # Offense count: 172
157
+ # Offense count: 187
152
158
  RSpec/MultipleExpectations:
153
159
  Max: 14
154
160
 
155
- # Offense count: 24
161
+ # Offense count: 30
156
162
  # Configuration parameters: AllowSubject.
157
163
  RSpec/MultipleMemoizedHelpers:
158
164
  Max: 9
159
165
 
160
- # Offense count: 24
166
+ # Offense count: 105
161
167
  # Configuration parameters: AllowedGroups.
162
168
  RSpec/NestedGroups:
163
169
  Max: 4
@@ -176,6 +182,11 @@ RSpec/RemoveConst:
176
182
  Exclude:
177
183
  - 'spec/lutaml/model/type_spec.rb'
178
184
 
185
+ # Offense count: 3
186
+ RSpec/RepeatedExample:
187
+ Exclude:
188
+ - 'spec/lutaml/model/key_value_mapping_spec.rb'
189
+
179
190
  # Offense count: 2
180
191
  RSpec/RepeatedExampleGroupBody:
181
192
  Exclude:
@@ -207,6 +218,14 @@ Security/CompoundHash:
207
218
  Exclude:
208
219
  - 'lib/lutaml/model/comparable_model.rb'
209
220
 
221
+ # Offense count: 1
222
+ # This cop supports unsafe autocorrection (--autocorrect-all).
223
+ # Configuration parameters: AllowedReceivers.
224
+ # AllowedReceivers: Thread.current
225
+ Style/HashEachMethods:
226
+ Exclude:
227
+ - 'lib/lutaml/model/schema/xml_compiler.rb'
228
+
210
229
  # Offense count: 1
211
230
  Style/MissingRespondToMissing:
212
231
  Exclude:
@@ -219,6 +238,13 @@ Style/OptionalBooleanParameter:
219
238
  Exclude:
220
239
  - 'lib/lutaml/model/comparable_model.rb'
221
240
 
241
+ # Offense count: 4
242
+ # This cop supports safe autocorrection (--autocorrect).
243
+ Style/RedundantStringEscape:
244
+ Exclude:
245
+ - 'lib/lutaml/model/schema/templates/simple_type.rb'
246
+ - 'lib/lutaml/model/schema/xml_compiler.rb'
247
+
222
248
  # Offense count: 1
223
249
  # This cop supports unsafe autocorrection (--autocorrect-all).
224
250
  # Configuration parameters: Mode.
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ gemspec
7
7
 
8
8
  gem "bigdecimal"
9
9
  gem "equivalent-xml"
10
+ gem "lutaml-xsd"
10
11
  gem "multi_json"
11
12
  gem "nokogiri"
12
13
  gem "oga"