lutaml-model 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-tests.yml +2 -0
  3. data/.rubocop_todo.yml +86 -23
  4. data/Gemfile +2 -0
  5. data/README.adoc +1441 -220
  6. data/lib/lutaml/model/attribute.rb +33 -10
  7. data/lib/lutaml/model/choice.rb +56 -0
  8. data/lib/lutaml/model/config.rb +1 -0
  9. data/lib/lutaml/model/constants.rb +7 -0
  10. data/lib/lutaml/model/error/choice_lower_bound_error.rb +9 -0
  11. data/lib/lutaml/model/error/choice_upper_bound_error.rb +9 -0
  12. data/lib/lutaml/model/error/import_model_with_root_error.rb +9 -0
  13. data/lib/lutaml/model/error/incorrect_sequence_error.rb +9 -0
  14. data/lib/lutaml/model/error/invalid_choice_range_error.rb +20 -0
  15. data/lib/lutaml/model/error/no_root_mapping_error.rb +9 -0
  16. data/lib/lutaml/model/error/no_root_namespace_error.rb +9 -0
  17. data/lib/lutaml/model/error/type/invalid_value_error.rb +19 -0
  18. data/lib/lutaml/model/error/unknown_sequence_mapping_error.rb +9 -0
  19. data/lib/lutaml/model/error.rb +9 -0
  20. data/lib/lutaml/model/json_adapter/standard_json_adapter.rb +6 -1
  21. data/lib/lutaml/model/key_value_mapping.rb +34 -3
  22. data/lib/lutaml/model/key_value_mapping_rule.rb +4 -2
  23. data/lib/lutaml/model/liquefiable.rb +59 -0
  24. data/lib/lutaml/model/mapping_hash.rb +9 -1
  25. data/lib/lutaml/model/mapping_rule.rb +19 -2
  26. data/lib/lutaml/model/schema/templates/simple_type.rb +247 -0
  27. data/lib/lutaml/model/schema/xml_compiler.rb +762 -0
  28. data/lib/lutaml/model/schema.rb +5 -0
  29. data/lib/lutaml/model/schema_location.rb +7 -0
  30. data/lib/lutaml/model/sequence.rb +71 -0
  31. data/lib/lutaml/model/serialize.rb +139 -33
  32. data/lib/lutaml/model/toml_adapter/toml_rb_adapter.rb +1 -2
  33. data/lib/lutaml/model/type/decimal.rb +0 -4
  34. data/lib/lutaml/model/type/hash.rb +11 -11
  35. data/lib/lutaml/model/type/time.rb +3 -3
  36. data/lib/lutaml/model/utils.rb +19 -15
  37. data/lib/lutaml/model/validation.rb +12 -1
  38. data/lib/lutaml/model/version.rb +1 -1
  39. data/lib/lutaml/model/xml_adapter/builder/oga.rb +10 -7
  40. data/lib/lutaml/model/xml_adapter/builder/ox.rb +20 -13
  41. data/lib/lutaml/model/xml_adapter/element.rb +32 -0
  42. data/lib/lutaml/model/xml_adapter/nokogiri_adapter.rb +13 -9
  43. data/lib/lutaml/model/xml_adapter/oga/element.rb +14 -13
  44. data/lib/lutaml/model/xml_adapter/oga_adapter.rb +86 -19
  45. data/lib/lutaml/model/xml_adapter/ox_adapter.rb +19 -15
  46. data/lib/lutaml/model/xml_adapter/xml_document.rb +82 -25
  47. data/lib/lutaml/model/xml_adapter/xml_element.rb +57 -3
  48. data/lib/lutaml/model/xml_mapping.rb +53 -9
  49. data/lib/lutaml/model/xml_mapping_rule.rb +8 -6
  50. data/lib/lutaml/model.rb +2 -0
  51. data/lutaml-model.gemspec +5 -0
  52. data/spec/benchmarks/xml_parsing_benchmark_spec.rb +75 -0
  53. data/spec/ceramic_spec.rb +39 -0
  54. data/spec/fixtures/ceramic.rb +23 -0
  55. data/spec/fixtures/xml/address_example_260.xsd +9 -0
  56. data/spec/fixtures/xml/invalid_math_document.xml +4 -0
  57. data/spec/fixtures/xml/math_document_schema.xsd +56 -0
  58. data/spec/fixtures/xml/test_schema.xsd +53 -0
  59. data/spec/fixtures/xml/user.xsd +10 -0
  60. data/spec/fixtures/xml/valid_math_document.xml +4 -0
  61. data/spec/lutaml/model/cdata_spec.rb +4 -5
  62. data/spec/lutaml/model/choice_spec.rb +168 -0
  63. data/spec/lutaml/model/collection_spec.rb +1 -1
  64. data/spec/lutaml/model/custom_model_spec.rb +7 -21
  65. data/spec/lutaml/model/custom_serialization_spec.rb +74 -2
  66. data/spec/lutaml/model/defaults_spec.rb +3 -1
  67. data/spec/lutaml/model/delegation_spec.rb +7 -5
  68. data/spec/lutaml/model/enum_spec.rb +35 -0
  69. data/spec/lutaml/model/group_spec.rb +160 -0
  70. data/spec/lutaml/model/inheritance_spec.rb +25 -0
  71. data/spec/lutaml/model/key_value_mapping_spec.rb +27 -0
  72. data/spec/lutaml/model/liquefiable_spec.rb +121 -0
  73. data/spec/lutaml/model/map_all_spec.rb +188 -0
  74. data/spec/lutaml/model/mixed_content_spec.rb +95 -56
  75. data/spec/lutaml/model/multiple_mapping_spec.rb +22 -10
  76. data/spec/lutaml/model/schema/xml_compiler_spec.rb +1624 -0
  77. data/spec/lutaml/model/sequence_spec.rb +216 -0
  78. data/spec/lutaml/model/transformation_spec.rb +230 -0
  79. data/spec/lutaml/model/type_spec.rb +138 -31
  80. data/spec/lutaml/model/utils_spec.rb +32 -0
  81. data/spec/lutaml/model/with_child_mapping_spec.rb +2 -2
  82. data/spec/lutaml/model/xml_adapter/oga_adapter_spec.rb +11 -7
  83. data/spec/lutaml/model/xml_adapter/xml_namespace_spec.rb +52 -0
  84. data/spec/lutaml/model/xml_mapping_rule_spec.rb +51 -0
  85. data/spec/lutaml/model/xml_mapping_spec.rb +250 -112
  86. metadata +77 -2
metadata CHANGED
@@ -1,15 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-11 00:00:00.000000000 Z
11
+ date: 2025-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: liquid
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: moxml
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.2
13
55
  - !ruby/object:Gem::Dependency
14
56
  name: thor
15
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,21 +94,32 @@ files:
52
94
  - exe/lutaml-model
53
95
  - lib/lutaml/model.rb
54
96
  - lib/lutaml/model/attribute.rb
97
+ - lib/lutaml/model/choice.rb
55
98
  - lib/lutaml/model/cli.rb
56
99
  - lib/lutaml/model/comparable_model.rb
57
100
  - lib/lutaml/model/comparable_nil.rb
58
101
  - lib/lutaml/model/comparison.rb
59
102
  - lib/lutaml/model/config.rb
103
+ - lib/lutaml/model/constants.rb
60
104
  - lib/lutaml/model/error.rb
105
+ - lib/lutaml/model/error/choice_lower_bound_error.rb
106
+ - lib/lutaml/model/error/choice_upper_bound_error.rb
61
107
  - lib/lutaml/model/error/collection_count_out_of_range_error.rb
62
108
  - lib/lutaml/model/error/collection_true_missing_error.rb
109
+ - lib/lutaml/model/error/import_model_with_root_error.rb
63
110
  - lib/lutaml/model/error/incorrect_mapping_argument_error.rb
111
+ - lib/lutaml/model/error/incorrect_sequence_error.rb
112
+ - lib/lutaml/model/error/invalid_choice_range_error.rb
64
113
  - lib/lutaml/model/error/invalid_value_error.rb
65
114
  - lib/lutaml/model/error/multiple_mappings_error.rb
115
+ - lib/lutaml/model/error/no_root_mapping_error.rb
116
+ - lib/lutaml/model/error/no_root_namespace_error.rb
66
117
  - lib/lutaml/model/error/pattern_not_matched_error.rb
118
+ - lib/lutaml/model/error/type/invalid_value_error.rb
67
119
  - lib/lutaml/model/error/type_error.rb
68
120
  - lib/lutaml/model/error/type_not_enabled_error.rb
69
121
  - lib/lutaml/model/error/unknown_adapter_type_error.rb
122
+ - lib/lutaml/model/error/unknown_sequence_mapping_error.rb
70
123
  - lib/lutaml/model/error/unknown_type_error.rb
71
124
  - lib/lutaml/model/error/validation_error.rb
72
125
  - lib/lutaml/model/json_adapter.rb
@@ -76,6 +129,7 @@ files:
76
129
  - lib/lutaml/model/json_adapter/standard_json_adapter.rb
77
130
  - lib/lutaml/model/key_value_mapping.rb
78
131
  - lib/lutaml/model/key_value_mapping_rule.rb
132
+ - lib/lutaml/model/liquefiable.rb
79
133
  - lib/lutaml/model/loggable.rb
80
134
  - lib/lutaml/model/mapping_hash.rb
81
135
  - lib/lutaml/model/mapping_rule.rb
@@ -83,9 +137,12 @@ files:
83
137
  - lib/lutaml/model/schema/json_schema.rb
84
138
  - lib/lutaml/model/schema/json_schema_parser.rb
85
139
  - lib/lutaml/model/schema/relaxng_schema.rb
140
+ - lib/lutaml/model/schema/templates/simple_type.rb
141
+ - lib/lutaml/model/schema/xml_compiler.rb
86
142
  - lib/lutaml/model/schema/xsd_schema.rb
87
143
  - lib/lutaml/model/schema/yaml_schema.rb
88
144
  - lib/lutaml/model/schema_location.rb
145
+ - lib/lutaml/model/sequence.rb
89
146
  - lib/lutaml/model/serializable.rb
90
147
  - lib/lutaml/model/serialize.rb
91
148
  - lib/lutaml/model/toml_adapter.rb
@@ -112,6 +169,7 @@ files:
112
169
  - lib/lutaml/model/xml_adapter/builder/nokogiri.rb
113
170
  - lib/lutaml/model/xml_adapter/builder/oga.rb
114
171
  - lib/lutaml/model/xml_adapter/builder/ox.rb
172
+ - lib/lutaml/model/xml_adapter/element.rb
115
173
  - lib/lutaml/model/xml_adapter/nokogiri_adapter.rb
116
174
  - lib/lutaml/model/xml_adapter/oga/document.rb
117
175
  - lib/lutaml/model/xml_adapter/oga/element.rb
@@ -130,15 +188,25 @@ files:
130
188
  - lutaml-model.gemspec
131
189
  - sig/lutaml/model.rbs
132
190
  - spec/address_spec.rb
191
+ - spec/benchmarks/xml_parsing_benchmark_spec.rb
192
+ - spec/ceramic_spec.rb
133
193
  - spec/fixtures/address.rb
194
+ - spec/fixtures/ceramic.rb
134
195
  - spec/fixtures/person.rb
135
196
  - spec/fixtures/sample_model.rb
136
197
  - spec/fixtures/vase.rb
198
+ - spec/fixtures/xml/address_example_260.xsd
199
+ - spec/fixtures/xml/invalid_math_document.xml
137
200
  - spec/fixtures/xml/latin_encoding.xml
201
+ - spec/fixtures/xml/math_document_schema.xsd
138
202
  - spec/fixtures/xml/shift_jis.xml
139
203
  - spec/fixtures/xml/special_char.xml
204
+ - spec/fixtures/xml/test_schema.xsd
205
+ - spec/fixtures/xml/user.xsd
206
+ - spec/fixtures/xml/valid_math_document.xml
140
207
  - spec/lutaml/model/attribute_spec.rb
141
208
  - spec/lutaml/model/cdata_spec.rb
209
+ - spec/lutaml/model/choice_spec.rb
142
210
  - spec/lutaml/model/collection_spec.rb
143
211
  - spec/lutaml/model/comparable_model_spec.rb
144
212
  - spec/lutaml/model/custom_model_spec.rb
@@ -146,10 +214,13 @@ files:
146
214
  - spec/lutaml/model/defaults_spec.rb
147
215
  - spec/lutaml/model/delegation_spec.rb
148
216
  - spec/lutaml/model/enum_spec.rb
217
+ - spec/lutaml/model/group_spec.rb
149
218
  - spec/lutaml/model/included_spec.rb
150
219
  - spec/lutaml/model/inheritance_spec.rb
151
220
  - spec/lutaml/model/json_adapter_spec.rb
152
221
  - spec/lutaml/model/key_value_mapping_spec.rb
222
+ - spec/lutaml/model/liquefiable_spec.rb
223
+ - spec/lutaml/model/map_all_spec.rb
153
224
  - spec/lutaml/model/map_content_spec.rb
154
225
  - spec/lutaml/model/mixed_content_spec.rb
155
226
  - spec/lutaml/model/multiple_mapping_spec.rb
@@ -159,12 +230,15 @@ files:
159
230
  - spec/lutaml/model/root_mappings_spec.rb
160
231
  - spec/lutaml/model/schema/json_schema_spec.rb
161
232
  - spec/lutaml/model/schema/relaxng_schema_spec.rb
233
+ - spec/lutaml/model/schema/xml_compiler_spec.rb
162
234
  - spec/lutaml/model/schema/xsd_schema_spec.rb
163
235
  - spec/lutaml/model/schema/yaml_schema_spec.rb
236
+ - spec/lutaml/model/sequence_spec.rb
164
237
  - spec/lutaml/model/serializable_spec.rb
165
238
  - spec/lutaml/model/serializable_validation_spec.rb
166
239
  - spec/lutaml/model/simple_model_spec.rb
167
240
  - spec/lutaml/model/toml_adapter_spec.rb
241
+ - spec/lutaml/model/transformation_spec.rb
168
242
  - spec/lutaml/model/type/boolean_spec.rb
169
243
  - spec/lutaml/model/type/date_spec.rb
170
244
  - spec/lutaml/model/type/date_time_spec.rb
@@ -184,6 +258,7 @@ files:
184
258
  - spec/lutaml/model/xml_adapter/ox_adapter_spec.rb
185
259
  - spec/lutaml/model/xml_adapter/xml_namespace_spec.rb
186
260
  - spec/lutaml/model/xml_adapter_spec.rb
261
+ - spec/lutaml/model/xml_mapping_rule_spec.rb
187
262
  - spec/lutaml/model/xml_mapping_spec.rb
188
263
  - spec/lutaml/model/yaml_adapter_spec.rb
189
264
  - spec/lutaml/model_spec.rb