lutaml-model 0.3.0 → 0.3.2

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -5
  3. data/.rubocop_todo.yml +20 -101
  4. data/Gemfile +3 -18
  5. data/README.adoc +1100 -140
  6. data/lib/lutaml/model/attribute.rb +15 -2
  7. data/lib/lutaml/model/config.rb +0 -1
  8. data/lib/lutaml/model/error/invalid_value_error.rb +18 -0
  9. data/lib/lutaml/model/error.rb +8 -0
  10. data/lib/lutaml/model/json_adapter/json_document.rb +20 -0
  11. data/lib/lutaml/model/json_adapter/json_object.rb +28 -0
  12. data/lib/lutaml/model/json_adapter/{multi_json.rb → multi_json_adapter.rb} +2 -3
  13. data/lib/lutaml/model/json_adapter/{standard.rb → standard_json_adapter.rb} +2 -3
  14. data/lib/lutaml/model/json_adapter.rb +1 -31
  15. data/lib/lutaml/model/key_value_mapping.rb +9 -2
  16. data/lib/lutaml/model/key_value_mapping_rule.rb +0 -1
  17. data/lib/lutaml/model/mapping_hash.rb +0 -2
  18. data/lib/lutaml/model/mapping_rule.rb +5 -3
  19. data/lib/lutaml/model/schema/json_schema.rb +0 -1
  20. data/lib/lutaml/model/schema/relaxng_schema.rb +0 -1
  21. data/lib/lutaml/model/schema/xsd_schema.rb +0 -1
  22. data/lib/lutaml/model/schema/yaml_schema.rb +0 -1
  23. data/lib/lutaml/model/schema.rb +0 -1
  24. data/lib/lutaml/model/serializable.rb +0 -1
  25. data/lib/lutaml/model/serialize.rb +241 -153
  26. data/lib/lutaml/model/toml_adapter/toml_document.rb +20 -0
  27. data/lib/lutaml/model/toml_adapter/toml_object.rb +28 -0
  28. data/lib/lutaml/model/toml_adapter/toml_rb_adapter.rb +4 -5
  29. data/lib/lutaml/model/toml_adapter/tomlib_adapter.rb +2 -3
  30. data/lib/lutaml/model/toml_adapter.rb +0 -31
  31. data/lib/lutaml/model/type/date_time.rb +20 -0
  32. data/lib/lutaml/model/type/json.rb +34 -0
  33. data/lib/lutaml/model/type/time_without_date.rb +4 -3
  34. data/lib/lutaml/model/type.rb +61 -124
  35. data/lib/lutaml/model/version.rb +1 -1
  36. data/lib/lutaml/model/xml_adapter/nokogiri_adapter.rb +20 -13
  37. data/lib/lutaml/model/xml_adapter/oga_adapter.rb +4 -5
  38. data/lib/lutaml/model/xml_adapter/ox_adapter.rb +24 -17
  39. data/lib/lutaml/model/xml_adapter/xml_attribute.rb +27 -0
  40. data/lib/lutaml/model/xml_adapter/xml_document.rb +184 -0
  41. data/lib/lutaml/model/xml_adapter/xml_element.rb +94 -0
  42. data/lib/lutaml/model/xml_adapter/xml_namespace.rb +49 -0
  43. data/lib/lutaml/model/xml_adapter.rb +0 -266
  44. data/lib/lutaml/model/xml_mapping.rb +1 -1
  45. data/lib/lutaml/model/xml_mapping_rule.rb +3 -4
  46. data/lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb +34 -0
  47. data/lib/lutaml/model/yaml_adapter/yaml_document.rb +20 -0
  48. data/lib/lutaml/model/yaml_adapter/yaml_object.rb +28 -0
  49. data/lib/lutaml/model/yaml_adapter.rb +1 -19
  50. data/lib/lutaml/model.rb +7 -5
  51. metadata +19 -5
  52. data/lib/lutaml/model/xml_namespace.rb +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b948b6c3373e3a5cbe98462e88fe5b945542d9f509b313dd21af2f333859884
4
- data.tar.gz: 0c53660f6ff3f8ad249c3368c6c1477eb4d5ea1d426d9c4db44216efec9e5b56
3
+ metadata.gz: f9a3608f755616317667038ebd8f71368c23dcf935a7b07ad33d8efd1fa1df23
4
+ data.tar.gz: 9a69a3a03c401fa4a0eff423315dc979e4f5b87c28b28bf4b4d10b7f118b6a77
5
5
  SHA512:
6
- metadata.gz: 032c506ddc4f5173281092dae4828c63717454dbcdf8ed44fb30bc94482552bffbfbf830084c9ae1b832c49db802f940b81adf684ea94d684d0496bd804e5dbf
7
- data.tar.gz: 4b75612301d6df11570f30b04ddd7800b666ae354a9c2171d553fc14cce21846795c54f88e25c4a35896ee66701b14c27fd825f9146fdd3ec469ede544405bd3
6
+ metadata.gz: 612d55df7ef46e1266b6d6e2fa4a6e451862252895a8f8b66b0a1f42bb96d289fc28c160ee1e2d609bc4ebc4ce8db00d14a1fca3061e8465a2f867403f5672b0
7
+ data.tar.gz: 20235f85e8719fceb5a048dfcebf9f80e0a1c3c2d3bc2f6779fd0e1480d77c989adcc1bdedc661e440dbd861e7cf04682321626693281ac9c21920d45310f6b6
data/.rubocop.yml CHANGED
@@ -2,12 +2,8 @@ inherit_from:
2
2
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
3
3
  - .rubocop_todo.yml
4
4
 
5
- # local repo-specific modifications
6
- # ...
7
- #
8
5
  require:
9
6
  - rubocop-performance
10
- - rubocop-rails
11
7
  - rubocop-rake
12
8
  - rubocop-rspec
13
9
 
@@ -15,5 +11,4 @@ AllCops:
15
11
  TargetRubyVersion: 3.0
16
12
  NewCops: enable
17
13
  Exclude:
18
- - 'lib/sts/mapper.rb'
19
14
  - 'vendor/**/*'
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2024-07-31 10:20:40 UTC using RuboCop version 1.64.1.
3
+ # on 2024-08-15 09:04:06 UTC using RuboCop version 1.65.1.
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
@@ -14,7 +14,7 @@ Gemspec/RequireMFA:
14
14
  Exclude:
15
15
  - 'lutaml-model.gemspec'
16
16
 
17
- # Offense count: 15
17
+ # Offense count: 28
18
18
  # This cop supports safe autocorrection (--autocorrect).
19
19
  # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
20
20
  # URISchemes: http, https
@@ -22,10 +22,10 @@ Layout/LineLength:
22
22
  Exclude:
23
23
  - 'lib/lutaml/model/serialize.rb'
24
24
  - 'lib/lutaml/model/type.rb'
25
- - 'lib/lutaml/model/xml_adapter.rb'
26
25
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
27
26
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
28
- - 'spec/lutaml/model/xml_namespace_spec.rb'
27
+ - 'lib/lutaml/model/xml_adapter/xml_document.rb'
28
+ - 'spec/lutaml/model/delegation_spec.rb'
29
29
 
30
30
  # Offense count: 20
31
31
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
@@ -33,9 +33,9 @@ Metrics/AbcSize:
33
33
  Exclude:
34
34
  - 'lib/lutaml/model/serialize.rb'
35
35
  - 'lib/lutaml/model/type.rb'
36
- - 'lib/lutaml/model/xml_adapter.rb'
37
36
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
38
37
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
38
+ - 'lib/lutaml/model/xml_adapter/xml_document.rb'
39
39
 
40
40
  # Offense count: 3
41
41
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
@@ -43,50 +43,35 @@ Metrics/AbcSize:
43
43
  Metrics/BlockLength:
44
44
  Max: 30
45
45
 
46
- # Offense count: 17
46
+ # Offense count: 19
47
47
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
48
48
  Metrics/CyclomaticComplexity:
49
49
  Exclude:
50
50
  - 'lib/lutaml/model/serialize.rb'
51
51
  - 'lib/lutaml/model/type.rb'
52
- - 'lib/lutaml/model/xml_adapter.rb'
53
52
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
54
53
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
54
+ - 'lib/lutaml/model/xml_adapter/xml_document.rb'
55
55
 
56
- # Offense count: 24
56
+ # Offense count: 27
57
57
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
58
58
  Metrics/MethodLength:
59
- Max: 42
59
+ Max: 41
60
60
 
61
- # Offense count: 3
61
+ # Offense count: 4
62
62
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
63
63
  Metrics/ParameterLists:
64
64
  Max: 9
65
65
 
66
- # Offense count: 16
66
+ # Offense count: 17
67
67
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
68
68
  Metrics/PerceivedComplexity:
69
69
  Exclude:
70
70
  - 'lib/lutaml/model/serialize.rb'
71
71
  - 'lib/lutaml/model/type.rb'
72
- - 'lib/lutaml/model/xml_adapter.rb'
73
72
  - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
74
73
  - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
75
-
76
- # Offense count: 2
77
- # This cop supports unsafe autocorrection (--autocorrect-all).
78
- RSpec/BeEq:
79
- Exclude:
80
- - 'spec/lutaml/model/collection_spec.rb'
81
- - 'spec/lutaml/model/simple_model_spec.rb'
82
-
83
- # Offense count: 1
84
- # This cop supports safe autocorrection (--autocorrect).
85
- # Configuration parameters: EnforcedStyle.
86
- # SupportedStyles: be, be_nil
87
- RSpec/BeNil:
88
- Exclude:
89
- - 'spec/lutaml/model_spec.rb'
74
+ - 'lib/lutaml/model/xml_adapter/xml_document.rb'
90
75
 
91
76
  # Offense count: 6
92
77
  # Configuration parameters: Prefixes, AllowedPatterns.
@@ -97,22 +82,10 @@ RSpec/ContextWording:
97
82
  - 'spec/lutaml/model/xml_adapter/oga_adapter_spec.rb'
98
83
  - 'spec/lutaml/model/xml_adapter/ox_adapter_spec.rb'
99
84
 
100
- # Offense count: 18
101
- # This cop supports unsafe autocorrection (--autocorrect-all).
102
- # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
103
- # SupportedStyles: described_class, explicit
104
- RSpec/DescribedClass:
105
- Exclude:
106
- - 'spec/address_spec.rb'
107
- - 'spec/lutaml/model/custom_serialization_spec.rb'
108
- - 'spec/lutaml/model/defaults_spec.rb'
109
- - 'spec/lutaml/model/render_nil_spec.rb'
110
- - 'spec/person_spec.rb'
111
-
112
- # Offense count: 60
85
+ # Offense count: 63
113
86
  # Configuration parameters: CountAsOne.
114
87
  RSpec/ExampleLength:
115
- Max: 36
88
+ Max: 35
116
89
 
117
90
  # Offense count: 2
118
91
  # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
@@ -120,27 +93,19 @@ RSpec/IndexedLet:
120
93
  Exclude:
121
94
  - 'spec/address_spec.rb'
122
95
 
123
- # Offense count: 3
124
- # This cop supports safe autocorrection (--autocorrect).
125
- # Configuration parameters: AutoCorrect.
126
- RSpec/LetBeforeExamples:
127
- Exclude:
128
- - 'spec/lutaml/model/defaults_spec.rb'
129
- - 'spec/person_spec.rb'
130
-
131
96
  # Offense count: 4
132
97
  RSpec/MultipleDescribes:
133
98
  Exclude:
134
99
  - 'spec/lutaml/model/json_adapter_spec.rb'
135
100
  - 'spec/lutaml/model/toml_adapter_spec.rb'
101
+ - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
136
102
  - 'spec/lutaml/model/xml_adapter_spec.rb'
137
- - 'spec/lutaml/model/xml_namespace_spec.rb'
138
103
 
139
- # Offense count: 54
104
+ # Offense count: 63
140
105
  RSpec/MultipleExpectations:
141
106
  Max: 15
142
107
 
143
- # Offense count: 1
108
+ # Offense count: 11
144
109
  # Configuration parameters: AllowSubject.
145
110
  RSpec/MultipleMemoizedHelpers:
146
111
  Max: 9
@@ -149,59 +114,13 @@ RSpec/MultipleMemoizedHelpers:
149
114
  RSpec/PendingWithoutReason:
150
115
  Exclude:
151
116
  - 'spec/lutaml/model/xml_adapter/oga_adapter_spec.rb'
117
+ - 'spec/lutaml/model/xml_adapter/xml_namespace_spec.rb'
152
118
  - 'spec/lutaml/model/xml_adapter_spec.rb'
153
- - 'spec/lutaml/model/xml_namespace_spec.rb'
154
-
155
- # Offense count: 3
156
- # This cop supports safe autocorrection (--autocorrect).
157
- # Configuration parameters: AutoCorrect.
158
- RSpec/ScatteredLet:
159
- Exclude:
160
- - 'spec/lutaml/model/defaults_spec.rb'
161
- - 'spec/person_spec.rb'
162
119
 
163
- # Offense count: 5
120
+ # Offense count: 1
164
121
  # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
165
122
  # Include: **/*_spec.rb
166
123
  RSpec/SpecFilePathFormat:
167
124
  Exclude:
125
+ - '**/spec/routing/**/*'
168
126
  - 'spec/lutaml/model/collection_spec.rb'
169
- - 'spec/lutaml/model/xml_adapter/nokogiri_adapter_spec.rb'
170
- - 'spec/lutaml/model/xml_adapter/oga_adapter_spec.rb'
171
- - 'spec/lutaml/model/xml_adapter/ox_adapter_spec.rb'
172
- - 'spec/lutaml/model/yaml_adapter_spec.rb'
173
-
174
- # Offense count: 2
175
- # This cop supports unsafe autocorrection (--autocorrect-all).
176
- # Configuration parameters: Whitelist, AllowedMethods, AllowedReceivers.
177
- # Whitelist: find_by_sql, find_by_token_for
178
- # AllowedMethods: find_by_sql, find_by_token_for
179
- # AllowedReceivers: Gem::Specification, page
180
- Rails/DynamicFindBy:
181
- Exclude:
182
- - 'lib/lutaml/model/xml_adapter/nokogiri_adapter.rb'
183
- - 'lib/lutaml/model/xml_adapter/ox_adapter.rb'
184
-
185
- # Offense count: 1
186
- # This cop supports unsafe autocorrection (--autocorrect-all).
187
- Rails/NegateInclude:
188
- Exclude:
189
- - 'lib/lutaml/model/serialize.rb'
190
-
191
- # Offense count: 2
192
- # This cop supports safe autocorrection (--autocorrect).
193
- # Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
194
- Rails/Present:
195
- Exclude:
196
- - 'lib/lutaml/model/serialize.rb'
197
- - 'lib/lutaml/model/xml_namespace.rb'
198
-
199
- # Offense count: 6
200
- # This cop supports unsafe autocorrection (--autocorrect-all).
201
- # Configuration parameters: EnforcedStyle.
202
- # SupportedStyles: strict, flexible
203
- Rails/TimeZone:
204
- Exclude:
205
- - 'lib/lutaml/model/type.rb'
206
- - 'lib/lutaml/model/type/time_without_date.rb'
207
- - 'spec/person_spec.rb'
data/Gemfile CHANGED
@@ -5,32 +5,17 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in lutaml-model.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rspec", "~> 3.0"
11
-
12
- gem "rubocop", "~> 1.21"
13
-
14
8
  gem "equivalent-xml"
15
-
16
9
  gem "multi_json"
17
-
18
10
  gem "nokogiri"
19
-
20
11
  gem "oga"
21
-
22
12
  gem "ox"
23
-
24
13
  gem "pry"
25
-
14
+ gem "rake", "~> 13.0"
15
+ gem "rspec", "~> 3.0"
16
+ gem "rubocop", "~> 1.21"
26
17
  gem "rubocop-performance", require: false
27
-
28
- gem "rubocop-rails", require: false
29
-
30
18
  gem "rubocop-rake", require: false
31
-
32
19
  gem "rubocop-rspec", require: false
33
-
34
20
  gem "tomlib"
35
-
36
21
  gem "toml-rb"