dm-persevere-adapter 0.60.0 → 0.60.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/dm/property.rb +8 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.60.
|
1
|
+
0.60.1
|
data/lib/dm/property.rb
CHANGED
@@ -2,15 +2,21 @@ module DataMapper
|
|
2
2
|
class Property
|
3
3
|
|
4
4
|
def to_json_schema_hash(repo)
|
5
|
+
|
5
6
|
tm = repository(repo).adapter.type_map
|
7
|
+
type_information = tm[type]
|
8
|
+
if type_information.nil? && type.respond_to?(:primitive)
|
9
|
+
type_information = tm[type.primitive]
|
10
|
+
end
|
11
|
+
|
6
12
|
json_hash = Hash.new
|
7
|
-
json_hash = { "type" =>
|
13
|
+
json_hash = { "type" => type_information[:primitive] }
|
8
14
|
json_hash.merge!({ "optional" => true }) unless required?
|
9
15
|
json_hash.merge!({ "unique" => true}) if unique?
|
10
16
|
json_hash.merge!({ "position" => @position }) unless @position.nil?
|
11
17
|
json_hash.merge!({ "prefix" => @prefix }) unless @prefix.nil?
|
12
18
|
json_hash.merge!({ "separator" => @separator }) unless @separator.nil?
|
13
|
-
json_hash.merge!(
|
19
|
+
json_hash.merge!( type_information.reject{ |key,value| key == :primitive } )
|
14
20
|
|
15
21
|
json_hash
|
16
22
|
end
|