safrano 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dda061616194242041f7308c791bc5689fabaf0627f6f5090df3141fe5a34d8e
4
- data.tar.gz: bec6791bb225330e1e149bf4166012397f9ffce9df2dbe0be3d7b224c5172212
3
+ metadata.gz: 56284ecd8544233a820d8163c324a4b86df3f87909e529ac993407dad3358132
4
+ data.tar.gz: 3097012a5e22ccd3cc2b61e8ecc22427c35e8db12a02dfd3c9a819cfc13abd53
5
5
  SHA512:
6
- metadata.gz: 7aef08bdf67609d7e836b955e478f4b0a8cd67a08fc6caf0c9e9b263bac3d59086a6da59967cdacf5b3bb328060cbb20b9cdbe70e28fcacb5ce464e63eeb7e59
7
- data.tar.gz: 2f65e93d591fc18ca7836a17c61250bc181c1d9aff14bd875e2d2f4803406ca76d577c6cd4c0b5f7e468240ac6d63e9389f7367a5b6cba6bfa298c4c5efd5fcd
6
+ metadata.gz: 23fffb3c40b6264ca8489ded795330c14410419db07fbad0f1fb9781a3ae31668264747df93df8e2d8df45dcdc546d4a6c61cf8d66cee54b7abb7b32e85bef2e
7
+ data.tar.gz: a4473504fe30c922e3f6803dc608beb5495174ca3f884f4da04de479769a602fdc94df5f45c9a8edad2996146028d1cddacd626d61310b776ced641d32abbbd2
@@ -142,40 +142,39 @@ module Safrano
142
142
  @attribute_path_list = attribute_path_list
143
143
  end
144
144
 
145
- MAX_DEPTH = 4
146
- def attribute_path_list(depth = 0)
145
+ MAX_DEPTH = 6
146
+ MAX_TYPE_REPETITION = 2
147
+ def attribute_path_list(depth_path = [])
147
148
  ret = @columns_str.dup
148
149
  # break circles
149
- return ret if depth >= MAX_DEPTH
150
-
151
- depth += 1
150
+ return ret if depth_path.size > MAX_DEPTH
151
+ return ret if depth_path.count(self) > MAX_TYPE_REPETITION
152
152
 
153
153
  @nav_entity_attribs&.each do |a, k|
154
- ret.concat(k.attribute_path_list(depth).map { |kc| "#{a}/#{kc}" })
154
+ ret.concat(k.attribute_path_list(depth_path + [self]).map { |kc| "#{a}/#{kc}" })
155
155
  end
156
156
 
157
157
  @nav_collection_attribs&.each do |a, k|
158
- ret.concat(k.attribute_path_list(depth).map { |kc| "#{a}/#{kc}" })
158
+ ret.concat(k.attribute_path_list(depth_path + [self]).map { |kc| "#{a}/#{kc}" })
159
159
  end
160
160
  ret
161
161
  end
162
162
 
163
- def expand_path_list(depth = 0)
163
+ def expand_path_list(depth_path = [])
164
164
  ret = []
165
165
  ret.concat(@nav_entity_attribs_keys) if @nav_entity_attribs
166
166
  ret.concat(@nav_collection_attribs_keys) if @nav_collection_attribs
167
167
 
168
168
  # break circles
169
- return ret if depth >= MAX_DEPTH
170
-
171
- depth += 1
169
+ return ret if depth_path.size > MAX_DEPTH
170
+ return ret if depth_path.count(self) > MAX_TYPE_REPETITION
172
171
 
173
172
  @nav_entity_attribs&.each do |a, k|
174
- ret.concat(k.expand_path_list(depth).map { |kc| "#{a}/#{kc}" })
173
+ ret.concat(k.expand_path_list(depth_path + [self]).map { |kc| "#{a}/#{kc}" })
175
174
  end
176
175
 
177
176
  @nav_collection_attribs&.each do |a, k|
178
- ret.concat(k.expand_path_list(depth).map { |kc| "#{a}/#{kc}" })
177
+ ret.concat(k.expand_path_list(depth_path + [self]).map { |kc| "#{a}/#{kc}" })
179
178
  end
180
179
  ret
181
180
  end
@@ -446,8 +445,20 @@ module Safrano
446
445
 
447
446
  # check if key needs casting. Important for later entity-uri generation !
448
447
  return unless primary_key.is_a? Symbol # single key field
449
-
450
- @pk_castfunc = @casted_cols[primary_key]
448
+
449
+ # guid key as guid'xxx-yyy-zzz'
450
+ metadata = @cols_metadata[primary_key]
451
+
452
+ if metadata[:edm_type] == 'Edm.Guid'
453
+ props = db_schema[primary_key]
454
+ @pk_castfunc = if props[:type] == :blob # Edm.Guid but as 16 byte binary Blob on DB level, eg in Sqlite
455
+ lambda { |x| "guid'#{UUIDTools::UUID.parse_raw(x)}'" unless x.nil? }
456
+ else
457
+ lambda { |x| "guid'#{x}'" unless x.nil? }
458
+ end
459
+ else
460
+ @pk_castfunc = @casted_cols[primary_key]
461
+ end
451
462
  end # build_casted_cols(service)
452
463
 
453
464
  def finalize_publishing(service)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Safrano
4
- VERSION = '0.7.0'
4
+ VERSION = '0.7.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - oz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-02 00:00:00.000000000 Z
11
+ date: 2023-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -120,6 +120,20 @@ dependencies:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
122
  version: '2.2'
123
+ - !ruby/object:Gem::Dependency
124
+ name: rexml
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '3.0'
130
+ type: :runtime
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '3.0'
123
137
  - !ruby/object:Gem::Dependency
124
138
  name: rack-test
125
139
  requirement: !ruby/object:Gem::Requirement
@@ -231,14 +245,14 @@ files:
231
245
  - lib/safrano/type_mapping.rb
232
246
  - lib/safrano/version.rb
233
247
  - lib/sequel/plugins/join_by_paths.rb
234
- homepage: https://gitlab.com/dm0da/safrano
248
+ homepage: https://safrano.aithscel.eu
235
249
  licenses:
236
250
  - MIT
237
251
  metadata:
238
252
  bug_tracker_uri: https://gitlab.com/dm0da/safrano/issues
239
253
  changelog_uri: https://gitlab.com/dm0da/safrano/blob/master/CHANGELOG
240
254
  source_code_uri: https://gitlab.com/dm0da/safrano/tree/master
241
- wiki_uri: https://gitlab.com/dm0da/safrano/wikis/home
255
+ documentation_uri: https://gitlab.com/dm0da/safrano/-/blob/master/README.md
242
256
  post_install_message:
243
257
  rdoc_options: []
244
258
  require_paths: