lutaml-model 0.4.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +36 -20
  3. data/README.adoc +1003 -192
  4. data/lib/lutaml/model/attribute.rb +6 -2
  5. data/lib/lutaml/model/error/collection_true_missing_error.rb +16 -0
  6. data/lib/lutaml/model/error/multiple_mappings_error.rb +6 -0
  7. data/lib/lutaml/model/error.rb +2 -0
  8. data/lib/lutaml/model/key_value_mapping.rb +25 -4
  9. data/lib/lutaml/model/key_value_mapping_rule.rb +16 -3
  10. data/lib/lutaml/model/loggable.rb +15 -0
  11. data/lib/lutaml/model/mapping_rule.rb +14 -2
  12. data/lib/lutaml/model/serialize.rb +114 -64
  13. data/lib/lutaml/model/type/decimal.rb +5 -0
  14. data/lib/lutaml/model/version.rb +1 -1
  15. data/lib/lutaml/model/xml_adapter/builder/nokogiri.rb +1 -0
  16. data/lib/lutaml/model/xml_adapter/builder/oga.rb +180 -0
  17. data/lib/lutaml/model/xml_adapter/builder/ox.rb +1 -0
  18. data/lib/lutaml/model/xml_adapter/oga/document.rb +20 -0
  19. data/lib/lutaml/model/xml_adapter/oga/element.rb +117 -0
  20. data/lib/lutaml/model/xml_adapter/oga_adapter.rb +77 -44
  21. data/lib/lutaml/model/xml_adapter/xml_document.rb +14 -12
  22. data/lib/lutaml/model/xml_mapping.rb +3 -0
  23. data/lib/lutaml/model/xml_mapping_rule.rb +13 -4
  24. data/lib/lutaml/model.rb +1 -0
  25. data/spec/address_spec.rb +1 -0
  26. data/spec/fixtures/sample_model.rb +7 -0
  27. data/spec/lutaml/model/custom_model_spec.rb +47 -1
  28. data/spec/lutaml/model/included_spec.rb +192 -0
  29. data/spec/lutaml/model/mixed_content_spec.rb +48 -32
  30. data/spec/lutaml/model/multiple_mapping_spec.rb +329 -0
  31. data/spec/lutaml/model/ordered_content_spec.rb +1 -1
  32. data/spec/lutaml/model/render_nil_spec.rb +3 -0
  33. data/spec/lutaml/model/root_mappings_spec.rb +297 -0
  34. data/spec/lutaml/model/serializable_spec.rb +42 -7
  35. data/spec/lutaml/model/type/boolean_spec.rb +62 -0
  36. data/spec/lutaml/model/with_child_mapping_spec.rb +182 -0
  37. data/spec/lutaml/model/xml_adapter/oga_adapter_spec.rb +11 -11
  38. data/spec/lutaml/model/xml_adapter/xml_namespace_spec.rb +67 -1
  39. data/spec/lutaml/model/xml_adapter_spec.rb +2 -2
  40. data/spec/lutaml/model/xml_mapping_spec.rb +32 -9
  41. data/spec/sample_model_spec.rb +114 -0
  42. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa60d5495804e6bfc0203ba1a237f38b89b9626d036beeb2be8ca7aebb22426f
4
- data.tar.gz: 63d8d18127bee85cfaa73973f57554bc56385805dfeea1dad343c552277089d6
3
+ metadata.gz: 9643744c6317f6cbfa5e270954d5089cdce64961f5b0c8cd3ddffb228b2cbf84
4
+ data.tar.gz: b10af4981f13f897b4df81624539b6ae64748548e92af37ce0632e2279b96f6b
5
5
  SHA512:
6
- metadata.gz: 322a29941e7685a6e118d083f1b6e11ce6b8abc1cacb5508dd501f874c5ea3f2dc6f0e6719ce4895deb31c877319a3afe0e20d0820a81b8fd60d9fe59c408472
7
- data.tar.gz: ce087acefc221ed41180658b8c40d4cff5c0196c208647b9d1c5d0d39799849860abf80b981fe753b30a1176ca8633ed696440beeddef5a4493c1e829340f250
6
+ metadata.gz: 66cf686d10c146dc8d7f7a92c471a6da047e209f1fd37b748c1304f130176cd2473b69275b97072db9b8d08c93e4a480c028f1aa58980be5bc90091734b38a74
7
+ data.tar.gz: f6029050d1da6ce304eadea3902312b8c8d58311caf65cb2c1e7d43fd10092523ae2084a301d72cc19afaedc2f9d1fcd2291ef13a00caad4a673897fa7b60259
data/.rubocop_todo.yml CHANGED
@@ -1,19 +1,19 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2024-12-03 11:13:42 UTC using RuboCop version 1.66.1.
3
+ # on 2025-01-07 10:19: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: 224
9
+ # Offense count: 292
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
11
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
12
12
  # URISchemes: http, https
13
13
  Layout/LineLength:
14
14
  Enabled: false
15
15
 
16
- # Offense count: 12
16
+ # Offense count: 16
17
17
  # Configuration parameters: AllowedMethods.
18
18
  # AllowedMethods: enums
19
19
  Lint/ConstantDefinitionInBlock:
@@ -31,7 +31,7 @@ Lint/DuplicateMethods:
31
31
  Exclude:
32
32
  - 'lib/lutaml/model/type/float.rb'
33
33
 
34
- # Offense count: 37
34
+ # Offense count: 40
35
35
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
36
36
  Metrics/AbcSize:
37
37
  Exclude:
@@ -42,18 +42,20 @@ Metrics/AbcSize:
42
42
  - 'lib/lutaml/model/schema/xsd_schema.rb'
43
43
  - 'lib/lutaml/model/serialize.rb'
44
44
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
45
+ - 'lib/lutaml/model/xml_adapter/oga/element.rb'
46
+ - 'lib/lutaml/model/xml_adapter/oga_adapter.rb'
45
47
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
46
48
  - 'lib/lutaml/model/xml_adapter/xml_document.rb'
47
49
  - 'lib/lutaml/model/xml_mapping.rb'
48
50
  - 'lib/lutaml/model/xml_mapping_rule.rb'
49
51
 
50
- # Offense count: 6
52
+ # Offense count: 9
51
53
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
52
54
  # AllowedMethods: refine
53
55
  Metrics/BlockLength:
54
56
  Max: 46
55
57
 
56
- # Offense count: 28
58
+ # Offense count: 32
57
59
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
58
60
  Metrics/CyclomaticComplexity:
59
61
  Exclude:
@@ -61,21 +63,23 @@ Metrics/CyclomaticComplexity:
61
63
  - 'lib/lutaml/model/comparable_model.rb'
62
64
  - 'lib/lutaml/model/serialize.rb'
63
65
  - 'lib/lutaml/model/type/integer.rb'
66
+ - 'lib/lutaml/model/xml_adapter/builder/oga.rb'
64
67
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
68
+ - 'lib/lutaml/model/xml_adapter/oga_adapter.rb'
65
69
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
66
70
  - 'lib/lutaml/model/xml_adapter/xml_document.rb'
67
71
 
68
- # Offense count: 54
72
+ # Offense count: 63
69
73
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
70
74
  Metrics/MethodLength:
71
- Max: 46
75
+ Max: 45
72
76
 
73
77
  # Offense count: 7
74
78
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
75
79
  Metrics/ParameterLists:
76
- Max: 14
80
+ Max: 15
77
81
 
78
- # Offense count: 25
82
+ # Offense count: 30
79
83
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
80
84
  Metrics/PerceivedComplexity:
81
85
  Exclude:
@@ -83,10 +87,19 @@ Metrics/PerceivedComplexity:
83
87
  - 'lib/lutaml/model/comparable_model.rb'
84
88
  - 'lib/lutaml/model/serialize.rb'
85
89
  - 'lib/lutaml/model/type/integer.rb'
90
+ - 'lib/lutaml/model/xml_adapter/builder/oga.rb'
91
+ - 'lib/lutaml/model/xml_adapter/builder/ox.rb'
86
92
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
93
+ - 'lib/lutaml/model/xml_adapter/oga_adapter.rb'
87
94
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
88
95
  - 'lib/lutaml/model/xml_adapter/xml_document.rb'
89
96
 
97
+ # Offense count: 1
98
+ # This cop supports unsafe autocorrection (--autocorrect-all).
99
+ Performance/MapCompact:
100
+ Exclude:
101
+ - 'lib/lutaml/model/serialize.rb'
102
+
90
103
  # Offense count: 8
91
104
  # Configuration parameters: Prefixes, AllowedPatterns.
92
105
  # Prefixes: when, with, without
@@ -105,7 +118,7 @@ RSpec/DescribedClass:
105
118
  Exclude:
106
119
  - 'spec/lutaml/model/xml_mapping_spec.rb'
107
120
 
108
- # Offense count: 133
121
+ # Offense count: 139
109
122
  # Configuration parameters: CountAsOne.
110
123
  RSpec/ExampleLength:
111
124
  Max: 54
@@ -116,7 +129,7 @@ RSpec/IndexedLet:
116
129
  Exclude:
117
130
  - 'spec/address_spec.rb'
118
131
 
119
- # Offense count: 20
132
+ # Offense count: 24
120
133
  RSpec/LeakyConstantDeclaration:
121
134
  Exclude:
122
135
  - 'spec/lutaml/model/schema/json_schema_spec.rb'
@@ -135,7 +148,7 @@ RSpec/MultipleDescribes:
135
148
  - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
136
149
  - 'spec/lutaml/model/xml_adapter_spec.rb'
137
150
 
138
- # Offense count: 157
151
+ # Offense count: 172
139
152
  RSpec/MultipleExpectations:
140
153
  Max: 14
141
154
 
@@ -144,23 +157,19 @@ RSpec/MultipleExpectations:
144
157
  RSpec/MultipleMemoizedHelpers:
145
158
  Max: 9
146
159
 
147
- # Offense count: 15
160
+ # Offense count: 24
148
161
  # Configuration parameters: AllowedGroups.
149
162
  RSpec/NestedGroups:
150
163
  Max: 4
151
164
 
152
- # Offense count: 13
165
+ # Offense count: 9
153
166
  RSpec/PendingWithoutReason:
154
167
  Exclude:
155
- - 'spec/lutaml/model/mixed_content_spec.rb'
156
168
  - 'spec/lutaml/model/type/date_time_spec.rb'
157
169
  - 'spec/lutaml/model/type/integer_spec.rb'
158
170
  - 'spec/lutaml/model/type/time_spec.rb'
159
171
  - 'spec/lutaml/model/type/time_without_date_spec.rb'
160
172
  - 'spec/lutaml/model/validation_spec.rb'
161
- - 'spec/lutaml/model/xml_adapter/oga_adapter_spec.rb'
162
- - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
163
- - 'spec/lutaml/model/xml_adapter_spec.rb'
164
173
 
165
174
  # Offense count: 1
166
175
  RSpec/RemoveConst:
@@ -209,3 +218,10 @@ Style/MissingRespondToMissing:
209
218
  Style/OptionalBooleanParameter:
210
219
  Exclude:
211
220
  - 'lib/lutaml/model/comparable_model.rb'
221
+
222
+ # Offense count: 1
223
+ # This cop supports unsafe autocorrection (--autocorrect-all).
224
+ # Configuration parameters: Mode.
225
+ Style/StringConcatenation:
226
+ Exclude:
227
+ - 'spec/lutaml/model/xml_mapping_spec.rb'