lutaml-model 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +58 -21
  3. data/Gemfile +1 -0
  4. data/README.adoc +1112 -264
  5. data/lib/lutaml/model/attribute.rb +33 -10
  6. data/lib/lutaml/model/choice.rb +56 -0
  7. data/lib/lutaml/model/config.rb +1 -0
  8. data/lib/lutaml/model/error/choice_lower_bound_error.rb +9 -0
  9. data/lib/lutaml/model/error/choice_upper_bound_error.rb +9 -0
  10. data/lib/lutaml/model/error/import_model_with_root_error.rb +9 -0
  11. data/lib/lutaml/model/error/incorrect_sequence_error.rb +9 -0
  12. data/lib/lutaml/model/error/invalid_choice_range_error.rb +20 -0
  13. data/lib/lutaml/model/error/no_root_mapping_error.rb +9 -0
  14. data/lib/lutaml/model/error/no_root_namespace_error.rb +9 -0
  15. data/lib/lutaml/model/error/unknown_sequence_mapping_error.rb +9 -0
  16. data/lib/lutaml/model/error.rb +8 -0
  17. data/lib/lutaml/model/json_adapter/standard_json_adapter.rb +6 -1
  18. data/lib/lutaml/model/key_value_mapping.rb +3 -1
  19. data/lib/lutaml/model/key_value_mapping_rule.rb +4 -2
  20. data/lib/lutaml/model/liquefiable.rb +59 -0
  21. data/lib/lutaml/model/mapping_hash.rb +1 -1
  22. data/lib/lutaml/model/mapping_rule.rb +15 -2
  23. data/lib/lutaml/model/schema/xml_compiler.rb +68 -26
  24. data/lib/lutaml/model/schema_location.rb +7 -0
  25. data/lib/lutaml/model/sequence.rb +71 -0
  26. data/lib/lutaml/model/serialize.rb +125 -35
  27. data/lib/lutaml/model/type/decimal.rb +0 -4
  28. data/lib/lutaml/model/type/time.rb +3 -3
  29. data/lib/lutaml/model/utils.rb +19 -15
  30. data/lib/lutaml/model/validation.rb +12 -1
  31. data/lib/lutaml/model/version.rb +1 -1
  32. data/lib/lutaml/model/xml_adapter/builder/oga.rb +10 -7
  33. data/lib/lutaml/model/xml_adapter/builder/ox.rb +20 -13
  34. data/lib/lutaml/model/xml_adapter/element.rb +32 -0
  35. data/lib/lutaml/model/xml_adapter/nokogiri_adapter.rb +8 -8
  36. data/lib/lutaml/model/xml_adapter/oga/element.rb +14 -13
  37. data/lib/lutaml/model/xml_adapter/oga_adapter.rb +86 -19
  38. data/lib/lutaml/model/xml_adapter/ox_adapter.rb +19 -15
  39. data/lib/lutaml/model/xml_adapter/xml_document.rb +74 -13
  40. data/lib/lutaml/model/xml_adapter/xml_element.rb +57 -3
  41. data/lib/lutaml/model/xml_mapping.rb +49 -7
  42. data/lib/lutaml/model/xml_mapping_rule.rb +8 -3
  43. data/lib/lutaml/model.rb +1 -0
  44. data/lutaml-model.gemspec +5 -0
  45. data/spec/benchmarks/xml_parsing_benchmark_spec.rb +75 -0
  46. data/spec/ceramic_spec.rb +39 -0
  47. data/spec/fixtures/ceramic.rb +23 -0
  48. data/spec/fixtures/xml/address_example_260.xsd +9 -0
  49. data/spec/fixtures/xml/user.xsd +10 -0
  50. data/spec/lutaml/model/cdata_spec.rb +4 -5
  51. data/spec/lutaml/model/choice_spec.rb +168 -0
  52. data/spec/lutaml/model/collection_spec.rb +1 -1
  53. data/spec/lutaml/model/custom_model_spec.rb +6 -7
  54. data/spec/lutaml/model/custom_serialization_spec.rb +74 -2
  55. data/spec/lutaml/model/defaults_spec.rb +3 -1
  56. data/spec/lutaml/model/delegation_spec.rb +7 -5
  57. data/spec/lutaml/model/enum_spec.rb +35 -0
  58. data/spec/lutaml/model/group_spec.rb +160 -0
  59. data/spec/lutaml/model/inheritance_spec.rb +25 -0
  60. data/spec/lutaml/model/liquefiable_spec.rb +121 -0
  61. data/spec/lutaml/model/mixed_content_spec.rb +80 -41
  62. data/spec/lutaml/model/multiple_mapping_spec.rb +22 -10
  63. data/spec/lutaml/model/schema/xml_compiler_spec.rb +218 -25
  64. data/spec/lutaml/model/sequence_spec.rb +216 -0
  65. data/spec/lutaml/model/transformation_spec.rb +230 -0
  66. data/spec/lutaml/model/type_spec.rb +138 -31
  67. data/spec/lutaml/model/utils_spec.rb +32 -0
  68. data/spec/lutaml/model/xml_adapter/oga_adapter_spec.rb +11 -7
  69. data/spec/lutaml/model/xml_mapping_rule_spec.rb +51 -0
  70. data/spec/lutaml/model/xml_mapping_spec.rb +143 -112
  71. metadata +67 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 017de0dd3f1a97bc4fae79b00457e0f21fb8fc6c716de96224234a50344ca293
4
- data.tar.gz: ccdd5e4db10c87afd282feec45b13bc94ec8eeefa253fa5b0935cf9908eb1510
3
+ metadata.gz: 9883cb9431e9cd0c40c6e30891e1fb84861f1b9e9e7eb31a1cb5c6ec0d6121dc
4
+ data.tar.gz: 2d00bb121ca7486d151f4daaacb86f98824ef5950460dc4caecffe4280c93607
5
5
  SHA512:
6
- metadata.gz: 4bf32563b65d3832fbd8b56b49457ffa73e8021029ec3dfb040c46bd9b3a7efb75f3f7bb848c9ce9a30e6a00d41b96c190f408c228a43d0cb20cfdef21817eb2
7
- data.tar.gz: d010cb985aa94803c318aad8319fd6a972ff419f11e5b7ee52a6d2aca43587d60c2561161427d1eaad7d7a2af36fe5c981817dbc89302557bb16775819384a93
6
+ metadata.gz: df269be2c13bb4586e13d99dc79b47dbe1b445d49b8f23adf9c7ef502dae58deb77dd714431d29991c56e9aa9ac422a03910648e6f9a81414c7f375541fa6bf4
7
+ data.tar.gz: ed384722ad8f1fdb81671c8318ae0190c7372780a910ffece79e50658103344bd9f293afce048afa728cc91e47d952f6812bdbf2bce7a18d652d6704f9ef69cd
data/.rubocop_todo.yml CHANGED
@@ -1,37 +1,61 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-01-14 02:47:56 UTC using RuboCop version 1.69.2.
3
+ # on 2025-02-08 01:06:17 UTC using RuboCop version 1.71.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: 522
9
+ # Offense count: 2
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ Layout/ElseAlignment:
12
+ Exclude:
13
+ - 'lib/lutaml/model/schema/xml_compiler.rb'
14
+
15
+ # Offense count: 2
16
+ # This cop supports safe autocorrection (--autocorrect).
17
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
18
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
19
+ Layout/EndAlignment:
20
+ Exclude:
21
+ - 'lib/lutaml/model/schema/xml_compiler.rb'
22
+
23
+ # Offense count: 2
24
+ # This cop supports safe autocorrection (--autocorrect).
25
+ # Configuration parameters: Width, AllowedPatterns.
26
+ Layout/IndentationWidth:
27
+ Exclude:
28
+ - 'lib/lutaml/model/schema/xml_compiler.rb'
29
+
30
+ # Offense count: 596
10
31
  # This cop supports safe autocorrection (--autocorrect).
11
32
  # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
12
33
  # URISchemes: http, https
13
34
  Layout/LineLength:
14
35
  Enabled: false
15
36
 
16
- # Offense count: 16
37
+ # Offense count: 19
17
38
  # Configuration parameters: AllowedMethods.
18
39
  # AllowedMethods: enums
19
40
  Lint/ConstantDefinitionInBlock:
20
41
  Exclude:
42
+ - 'spec/benchmarks/xml_parsing_benchmark_spec.rb'
21
43
  - 'spec/lutaml/model/schema/json_schema_spec.rb'
22
44
  - 'spec/lutaml/model/schema/relaxng_schema_spec.rb'
23
45
  - 'spec/lutaml/model/schema/xsd_schema_spec.rb'
24
46
  - 'spec/lutaml/model/schema/yaml_schema_spec.rb'
25
- - 'spec/lutaml/model/type_spec.rb'
47
+ - 'spec/lutaml/model/transformation_spec.rb'
26
48
  - 'spec/lutaml/model/validation_spec.rb'
27
49
  - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
28
50
 
29
- # Offense count: 1
51
+ # Offense count: 4
30
52
  Lint/DuplicateMethods:
31
53
  Exclude:
32
54
  - 'lib/lutaml/model/type/float.rb'
55
+ - 'lib/lutaml/model/xml_adapter/xml_document.rb'
56
+ - 'lib/lutaml/model/xml_adapter/xml_element.rb'
33
57
 
34
- # Offense count: 54
58
+ # Offense count: 56
35
59
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
36
60
  Metrics/AbcSize:
37
61
  Exclude:
@@ -64,6 +88,7 @@ Metrics/CyclomaticComplexity:
64
88
  - 'lib/lutaml/model/attribute.rb'
65
89
  - 'lib/lutaml/model/comparable_model.rb'
66
90
  - 'lib/lutaml/model/key_value_mapping.rb'
91
+ - 'lib/lutaml/model/mapping_rule.rb'
67
92
  - 'lib/lutaml/model/schema/xml_compiler.rb'
68
93
  - 'lib/lutaml/model/serialize.rb'
69
94
  - 'lib/lutaml/model/type/integer.rb'
@@ -73,28 +98,28 @@ Metrics/CyclomaticComplexity:
73
98
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
74
99
  - 'lib/lutaml/model/xml_adapter/xml_document.rb'
75
100
 
76
- # Offense count: 83
101
+ # Offense count: 87
77
102
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
78
103
  Metrics/MethodLength:
79
- Max: 45
104
+ Max: 46
80
105
 
81
- # Offense count: 7
106
+ # Offense count: 8
82
107
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
83
108
  Metrics/ParameterLists:
84
- Max: 14
109
+ Max: 15
85
110
 
86
- # Offense count: 38
111
+ # Offense count: 37
87
112
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
88
113
  Metrics/PerceivedComplexity:
89
114
  Exclude:
90
115
  - 'lib/lutaml/model/attribute.rb'
91
116
  - 'lib/lutaml/model/comparable_model.rb'
92
117
  - 'lib/lutaml/model/key_value_mapping.rb'
118
+ - 'lib/lutaml/model/mapping_rule.rb'
93
119
  - 'lib/lutaml/model/schema/xml_compiler.rb'
94
120
  - 'lib/lutaml/model/serialize.rb'
95
121
  - 'lib/lutaml/model/type/integer.rb'
96
122
  - 'lib/lutaml/model/xml_adapter/builder/oga.rb'
97
- - 'lib/lutaml/model/xml_adapter/builder/ox.rb'
98
123
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
99
124
  - 'lib/lutaml/model/xml_adapter/oga_adapter.rb'
100
125
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
@@ -117,6 +142,18 @@ RSpec/ContextWording:
117
142
  - 'spec/lutaml/model/xml_mapping_spec.rb'
118
143
 
119
144
  # Offense count: 2
145
+ # Configuration parameters: IgnoredMetadata.
146
+ RSpec/DescribeClass:
147
+ Exclude:
148
+ - '**/spec/features/**/*'
149
+ - '**/spec/requests/**/*'
150
+ - '**/spec/routing/**/*'
151
+ - '**/spec/system/**/*'
152
+ - '**/spec/views/**/*'
153
+ - 'spec/benchmarks/xml_parsing_benchmark_spec.rb'
154
+ - 'spec/lutaml/model/transformation_spec.rb'
155
+
156
+ # Offense count: 1
120
157
  # This cop supports unsafe autocorrection (--autocorrect-all).
121
158
  # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
122
159
  # SupportedStyles: described_class, explicit
@@ -124,7 +161,7 @@ RSpec/DescribedClass:
124
161
  Exclude:
125
162
  - 'spec/lutaml/model/xml_mapping_spec.rb'
126
163
 
127
- # Offense count: 146
164
+ # Offense count: 169
128
165
  # Configuration parameters: CountAsOne.
129
166
  RSpec/ExampleLength:
130
167
  Max: 54
@@ -135,14 +172,15 @@ RSpec/IndexedLet:
135
172
  Exclude:
136
173
  - 'spec/address_spec.rb'
137
174
 
138
- # Offense count: 24
175
+ # Offense count: 30
139
176
  RSpec/LeakyConstantDeclaration:
140
177
  Exclude:
178
+ - 'spec/benchmarks/xml_parsing_benchmark_spec.rb'
141
179
  - 'spec/lutaml/model/schema/json_schema_spec.rb'
142
180
  - 'spec/lutaml/model/schema/relaxng_schema_spec.rb'
143
181
  - 'spec/lutaml/model/schema/xsd_schema_spec.rb'
144
182
  - 'spec/lutaml/model/schema/yaml_schema_spec.rb'
145
- - 'spec/lutaml/model/type_spec.rb'
183
+ - 'spec/lutaml/model/transformation_spec.rb'
146
184
  - 'spec/lutaml/model/validation_spec.rb'
147
185
  - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
148
186
 
@@ -154,7 +192,7 @@ RSpec/MultipleDescribes:
154
192
  - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
155
193
  - 'spec/lutaml/model/xml_adapter_spec.rb'
156
194
 
157
- # Offense count: 187
195
+ # Offense count: 213
158
196
  RSpec/MultipleExpectations:
159
197
  Max: 14
160
198
 
@@ -163,7 +201,7 @@ RSpec/MultipleExpectations:
163
201
  RSpec/MultipleMemoizedHelpers:
164
202
  Max: 9
165
203
 
166
- # Offense count: 105
204
+ # Offense count: 108
167
205
  # Configuration parameters: AllowedGroups.
168
206
  RSpec/NestedGroups:
169
207
  Max: 4
@@ -246,8 +284,7 @@ Style/RedundantStringEscape:
246
284
  - 'lib/lutaml/model/schema/xml_compiler.rb'
247
285
 
248
286
  # Offense count: 1
249
- # This cop supports unsafe autocorrection (--autocorrect-all).
250
- # Configuration parameters: Mode.
251
- Style/StringConcatenation:
287
+ # Configuration parameters: Max.
288
+ Style/SafeNavigationChainLength:
252
289
  Exclude:
253
- - 'spec/lutaml/model/xml_mapping_spec.rb'
290
+ - 'lib/lutaml/model/serialize.rb'
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in lutaml-model.gemspec
6
6
  gemspec
7
7
 
8
+ gem "benchmark-ips"
8
9
  gem "bigdecimal"
9
10
  gem "equivalent-xml"
10
11
  gem "lutaml-xsd"