@@ -20,17 +20,17 @@ def parse_representer_property(property)
20
20
documentation = property [ :documentation ] ? property [ :documentation ] . dup : { }
21
21
22
22
if property [ :decorator ] && property [ :nested ]
23
- representer_mapping ( property [ :decorator ] , documentation , is_a_collection , false , property [ :nested ] )
23
+ representer_mapping ( property [ :decorator ] , documentation , property , is_a_collection , false , property [ :nested ] )
24
24
elsif property [ :decorator ]
25
- representer_mapping ( property [ :decorator ] , documentation , is_a_collection , true )
25
+ representer_mapping ( property [ :decorator ] , documentation , property , is_a_collection , true )
26
26
elsif property [ :nested ]
27
- representer_mapping ( property [ :nested ] , documentation , is_a_collection )
27
+ representer_mapping ( property [ :nested ] , documentation , property , is_a_collection )
28
28
else
29
29
memo = {
30
- description : documentation [ :desc ] || ''
30
+ description : documentation [ :desc ] || property [ :desc ] || ''
31
31
}
32
32
33
- data_type = GrapeSwagger ::DocMethods ::DataType . call ( documentation [ :type ] )
33
+ data_type = GrapeSwagger ::DocMethods ::DataType . call ( documentation [ :type ] || property [ :type ] )
34
34
if GrapeSwagger ::DocMethods ::DataType . primitive? ( data_type )
35
35
data = GrapeSwagger ::DocMethods ::DataType . mapping ( data_type )
36
36
memo [ :type ] = data . first
@@ -39,7 +39,8 @@ def parse_representer_property(property)
39
39
memo [ :type ] = data_type
40
40
end
41
41
42
- memo [ :enum ] = documentation [ :values ] if documentation [ :values ] . is_a? ( Array )
42
+ values = documentation [ :values ] || property [ :values ] || nil
43
+ memo [ :enum ] = values if values . is_a? ( Array )
43
44
44
45
if is_a_collection || documentation [ :is_array ]
45
46
memo = {
@@ -52,7 +53,7 @@ def parse_representer_property(property)
52
53
end
53
54
end
54
55
55
- def representer_mapping ( representer , documentation , is_a_collection = false , is_a_decorator = false , nested = nil )
56
+ def representer_mapping ( representer , documentation , property , is_a_collection = false , is_a_decorator = false , nested = nil )
56
57
if nested . nil? && is_a_decorator
57
58
name = endpoint . send ( :expose_params_from_model , representer )
58
59
@@ -62,12 +63,12 @@ def representer_mapping(representer, documentation, is_a_collection = false, is_
62
63
items : {
63
64
'$ref' => "#/definitions/#{ name } "
64
65
} ,
65
- description : documentation [ :desc ] || ''
66
+ description : documentation [ :desc ] || property [ :desc ] || ''
66
67
}
67
68
else
68
69
{
69
70
'$ref' => "#/definitions/#{ name } " ,
70
- description : documentation [ :desc ] || ''
71
+ description : documentation [ :desc ] || property [ :desc ] || ''
71
72
}
72
73
end
73
74
else
@@ -81,13 +82,13 @@ def representer_mapping(representer, documentation, is_a_collection = false, is_
81
82
type : :object ,
82
83
properties : attributes
83
84
} ,
84
- description : documentation [ :desc ] || ''
85
+ description : documentation [ :desc ] || property [ :desc ] || ''
85
86
}
86
87
else
87
88
{
88
89
type : :object ,
89
90
properties : attributes ,
90
- description : documentation [ :desc ] || ''
91
+ description : documentation [ :desc ] || property [ :desc ] || ''
91
92
}
92
93
end
93
94
end
0 commit comments