@@ -21,7 +21,7 @@ class Tag < Representable::Decorator
21
21
class Error < Representable ::Decorator
22
22
include Representable ::JSON
23
23
24
- property :code , documentation : { type : 'string' , desc : 'Error code' }
24
+ property :code , default : 403 , documentation : { type : 'string' , desc : 'Error code' }
25
25
property :message , documentation : { type : 'string' , desc : 'Error message' }
26
26
end
27
27
@@ -39,7 +39,7 @@ class Something < Representable::Decorator
39
39
property :id , documentation : { required : true }
40
40
end
41
41
collection :tags , decorator : ThisInlineApi ::Representers ::Tag , documentation : { desc : 'Tags.' } do
42
- property :color , documentation : { type : String , desc : 'Tag color.' }
42
+ property :color , documentation : { type : String , desc : 'Tag color.' , values : -> { %w[ red blue green ] } , default : 'red' }
43
43
end
44
44
end
45
45
end
@@ -116,7 +116,7 @@ def app
116
116
'type' => 'object' ,
117
117
'description' => 'This returns something' ,
118
118
'properties' => {
119
- 'code' => { 'type' => 'string' , 'description' => 'Error code' } ,
119
+ 'code' => { 'type' => 'string' , 'description' => 'Error code' , 'default' => 403 } ,
120
120
'message' => { 'type' => 'string' , 'description' => 'Error message' }
121
121
}
122
122
)
@@ -157,7 +157,12 @@ def app
157
157
'type' => 'object' ,
158
158
'properties' => {
159
159
'name' => { 'description' => 'Name' , 'type' => 'string' , 'example' => 'A tag' } ,
160
- 'color' => { 'description' => 'Tag color.' , 'type' => 'string' }
160
+ 'color' => {
161
+ 'description' => 'Tag color.' ,
162
+ 'type' => 'string' ,
163
+ 'enum' => %w[ red blue green ] ,
164
+ 'default' => 'red'
165
+ }
161
166
}
162
167
} ,
163
168
'description' => 'Tags.'
0 commit comments