@@ -20,7 +20,7 @@ def app
20
20
'description' => 'OK' ,
21
21
'schema' => {
22
22
'type' => 'array' ,
23
- 'items' => { '$ref' => '#/definitions/ThisApi::Entities::Something ' }
23
+ 'items' => { '$ref' => '#/definitions/ThisApi_Entities_Something ' }
24
24
}
25
25
}
26
26
)
@@ -30,15 +30,15 @@ def app
30
30
expect ( subject [ 'paths' ] [ '/something/{id}' ] [ 'get' ] [ 'responses' ] ) . to eq (
31
31
'200' => {
32
32
'description' => 'OK' ,
33
- 'schema' => { '$ref' => '#/definitions/ThisApi::Entities::Something ' }
33
+ 'schema' => { '$ref' => '#/definitions/ThisApi_Entities_Something ' }
34
34
} ,
35
35
'403' => {
36
36
'description' => 'Refused to return something' ,
37
- 'schema' => { '$ref' => '#/definitions/ThisApi::Entities::Error ' }
37
+ 'schema' => { '$ref' => '#/definitions/ThisApi_Entities_Error ' }
38
38
}
39
39
)
40
- expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi::Entities::Error '
41
- expect ( subject [ 'definitions' ] [ 'ThisApi::Entities::Error ' ] ) . to eq (
40
+ expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi_Entities_Error '
41
+ expect ( subject [ 'definitions' ] [ 'ThisApi_Entities_Error ' ] ) . to eq (
42
42
'type' => 'object' ,
43
43
'description' => 'This returns something or an error' ,
44
44
'properties' => {
@@ -47,36 +47,36 @@ def app
47
47
}
48
48
)
49
49
50
- expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi::Entities::Something '
51
- expect ( subject [ 'definitions' ] [ 'ThisApi::Entities::Something ' ] ) . to eq (
50
+ expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi_Entities_Something '
51
+ expect ( subject [ 'definitions' ] [ 'ThisApi_Entities_Something ' ] ) . to eq (
52
52
'type' => 'object' ,
53
53
'description' => 'This returns something' ,
54
54
'properties' =>
55
55
{ 'text' => { 'type' => 'string' , 'description' => 'Content of something.' } ,
56
56
'colors' => { 'type' => 'array' , 'items' => { 'type' => 'string' } , 'description' => 'Colors' } ,
57
- 'kind' => { '$ref' => '#/definitions/ThisApi::Entities::Kind ' , 'description' => 'The kind of this something.' } ,
58
- 'kind2' => { '$ref' => '#/definitions/ThisApi::Entities::Kind ' , 'description' => 'Secondary kind.' } ,
59
- 'kind3' => { '$ref' => '#/definitions/ThisApi::Entities::Kind ' , 'description' => 'Tertiary kind.' } ,
60
- 'tags' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/ThisApi::Entities::Tag ' } , 'description' => 'Tags.' } ,
61
- 'relation' => { '$ref' => '#/definitions/ThisApi::Entities::Relation ' , 'description' => 'A related model.' } ,
57
+ 'kind' => { '$ref' => '#/definitions/ThisApi_Entities_Kind ' , 'description' => 'The kind of this something.' } ,
58
+ 'kind2' => { '$ref' => '#/definitions/ThisApi_Entities_Kind ' , 'description' => 'Secondary kind.' } ,
59
+ 'kind3' => { '$ref' => '#/definitions/ThisApi_Entities_Kind ' , 'description' => 'Tertiary kind.' } ,
60
+ 'tags' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/ThisApi_Entities_Tag ' } , 'description' => 'Tags.' } ,
61
+ 'relation' => { '$ref' => '#/definitions/ThisApi_Entities_Relation ' , 'description' => 'A related model.' } ,
62
62
'code' => { 'type' => 'string' , 'description' => 'Error code' } ,
63
63
'message' => { 'type' => 'string' , 'description' => 'Error message' } ,
64
64
'attr' => { 'type' => 'string' , 'description' => 'Attribute' } } ,
65
65
'required' => [ 'attr' ]
66
66
)
67
67
68
- expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi::Entities::Kind '
69
- expect ( subject [ 'definitions' ] [ 'ThisApi::Entities::Kind ' ] ) . to eq (
68
+ expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi_Entities_Kind '
69
+ expect ( subject [ 'definitions' ] [ 'ThisApi_Entities_Kind ' ] ) . to eq (
70
70
'type' => 'object' , 'properties' => { 'title' => { 'type' => 'string' , 'description' => 'Title of the kind.' } , 'content' => { 'description' => 'Content' , 'type' => 'string' , 'x-some' => 'stuff' } }
71
71
)
72
72
73
- expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi::Entities::Relation '
74
- expect ( subject [ 'definitions' ] [ 'ThisApi::Entities::Relation ' ] ) . to eq (
73
+ expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi_Entities_Relation '
74
+ expect ( subject [ 'definitions' ] [ 'ThisApi_Entities_Relation ' ] ) . to eq (
75
75
'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'Name' } }
76
76
)
77
77
78
- expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi::Entities::Tag '
79
- expect ( subject [ 'definitions' ] [ 'ThisApi::Entities::Tag ' ] ) . to eq (
78
+ expect ( subject [ 'definitions' ] . keys ) . to include 'ThisApi_Entities_Tag '
79
+ expect ( subject [ 'definitions' ] [ 'ThisApi_Entities_Tag ' ] ) . to eq (
80
80
'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'Name' } }
81
81
)
82
82
end
@@ -140,11 +140,11 @@ class Polymorphic < Grape::Entity
140
140
141
141
class SomeEntity < Grape ::Entity
142
142
expose :text , documentation : { type : 'string' , desc : 'Content of something.' }
143
- expose :kind , using : Kind , documentation : { type : 'TheseApi::Kind ' , desc : 'The kind of this something.' }
143
+ expose :kind , using : Kind , documentation : { type : 'TheseApi_Kind ' , desc : 'The kind of this something.' }
144
144
expose :kind2 , using : Kind , documentation : { desc : 'Secondary kind.' }
145
145
expose :kind3 , using : TheseApi ::Entities ::Kind , documentation : { desc : 'Tertiary kind.' }
146
146
expose :tags , using : TheseApi ::Entities ::Tag , documentation : { desc : 'Tags.' , is_array : true }
147
- expose :relation , using : TheseApi ::Entities ::Relation , documentation : { type : 'TheseApi::Relation ' , desc : 'A related model.' }
147
+ expose :relation , using : TheseApi ::Entities ::Relation , documentation : { type : 'TheseApi_Relation ' , desc : 'A related model.' }
148
148
expose :values , using : TheseApi ::Entities ::Values , documentation : { desc : 'Tertiary kind.' }
149
149
expose :nested , using : TheseApi ::Entities ::Nested , documentation : { desc : 'Nested object.' }
150
150
expose :polymorphic , using : TheseApi ::Entities ::Polymorphic , documentation : { desc : 'Polymorphic Model' }
@@ -177,28 +177,28 @@ def app
177
177
end
178
178
179
179
it 'prefers entity over other `using` values' do
180
- expect ( subject [ 'TheseApi::Entities::Values ' ] ) . to eql (
180
+ expect ( subject [ 'TheseApi_Entities_Values ' ] ) . to eql (
181
181
'type' => 'object' ,
182
182
'properties' => {
183
183
'guid' => { 'type' => 'string' , 'enum' => %w[ a b c ] , 'default' => 'c' , 'description' => 'Some values' } ,
184
184
'uuid' => { 'type' => 'string' , 'format' => 'own' , 'description' => 'customer uuid' , 'example' => 'e3008fba-d53d-4bcc-a6ae-adc56dff8020' }
185
185
}
186
186
)
187
- expect ( subject [ 'TheseApi::Entities::Kind ' ] ) . to eql (
187
+ expect ( subject [ 'TheseApi_Entities_Kind ' ] ) . to eql (
188
188
'type' => 'object' ,
189
189
'properties' => {
190
190
'id' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'id of the kind.' , 'enum' => [ 1 , 2 ] , 'readOnly' => true } ,
191
191
'title' => { 'type' => 'string' , 'description' => 'Title of the kind.' , 'readOnly' => false } ,
192
192
'type' => { 'type' => 'string' , 'description' => 'Type of the kind.' , 'readOnly' => true }
193
193
}
194
194
)
195
- expect ( subject [ 'TheseApi::Entities::Tag ' ] ) . to eql (
195
+ expect ( subject [ 'TheseApi_Entities_Tag ' ] ) . to eql (
196
196
'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'Name' , 'example' => 'random_tag' } }
197
197
)
198
- expect ( subject [ 'TheseApi::Entities::Relation ' ] ) . to eql (
198
+ expect ( subject [ 'TheseApi_Entities_Relation ' ] ) . to eql (
199
199
'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'Name' } }
200
200
)
201
- expect ( subject [ 'TheseApi::Entities::Nested ' ] ) . to eq (
201
+ expect ( subject [ 'TheseApi_Entities_Nested ' ] ) . to eq (
202
202
'properties' => {
203
203
'nested' => {
204
204
'type' => 'object' ,
@@ -250,30 +250,30 @@ def app
250
250
} ,
251
251
'type' => 'object'
252
252
)
253
- expect ( subject [ 'TheseApi::Entities::Polymorphic ' ] ) . to eql (
253
+ expect ( subject [ 'TheseApi_Entities_Polymorphic ' ] ) . to eql (
254
254
'type' => 'object' ,
255
255
'properties' => {
256
- 'kind' => { '$ref' => '#/definitions/TheseApi::Entities::Kind ' , 'description' => 'Polymorphic Kind' } ,
257
- 'values' => { '$ref' => '#/definitions/TheseApi::Entities::Values ' , 'description' => 'Polymorphic Values' } ,
256
+ 'kind' => { '$ref' => '#/definitions/TheseApi_Entities_Kind ' , 'description' => 'Polymorphic Kind' } ,
257
+ 'values' => { '$ref' => '#/definitions/TheseApi_Entities_Values ' , 'description' => 'Polymorphic Values' } ,
258
258
'str' => { 'type' => 'string' , 'description' => 'Polymorphic String' } ,
259
259
'num' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'Polymorphic Number' }
260
260
}
261
261
)
262
262
263
- expect ( subject [ 'TheseApi::Entities::SomeEntity ' ] ) . to eql (
263
+ expect ( subject [ 'TheseApi_Entities_SomeEntity ' ] ) . to eql (
264
264
'type' => 'object' ,
265
265
'properties' => {
266
266
'text' => { 'type' => 'string' , 'description' => 'Content of something.' } ,
267
- 'kind' => { '$ref' => '#/definitions/TheseApi::Entities::Kind ' , 'description' => 'The kind of this something.' } ,
268
- 'kind2' => { '$ref' => '#/definitions/TheseApi::Entities::Kind ' , 'description' => 'Secondary kind.' } ,
269
- 'kind3' => { '$ref' => '#/definitions/TheseApi::Entities::Kind ' , 'description' => 'Tertiary kind.' } ,
270
- 'tags' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/TheseApi::Entities::Tag ' } , 'description' => 'Tags.' } ,
271
- 'relation' => { '$ref' => '#/definitions/TheseApi::Entities::Relation ' , 'description' => 'A related model.' } ,
272
- 'values' => { '$ref' => '#/definitions/TheseApi::Entities::Values ' , 'description' => 'Tertiary kind.' } ,
273
- 'nested' => { '$ref' => '#/definitions/TheseApi::Entities::Nested ' , 'description' => 'Nested object.' } ,
267
+ 'kind' => { '$ref' => '#/definitions/TheseApi_Entities_Kind ' , 'description' => 'The kind of this something.' } ,
268
+ 'kind2' => { '$ref' => '#/definitions/TheseApi_Entities_Kind ' , 'description' => 'Secondary kind.' } ,
269
+ 'kind3' => { '$ref' => '#/definitions/TheseApi_Entities_Kind ' , 'description' => 'Tertiary kind.' } ,
270
+ 'tags' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/TheseApi_Entities_Tag ' } , 'description' => 'Tags.' } ,
271
+ 'relation' => { '$ref' => '#/definitions/TheseApi_Entities_Relation ' , 'description' => 'A related model.' } ,
272
+ 'values' => { '$ref' => '#/definitions/TheseApi_Entities_Values ' , 'description' => 'Tertiary kind.' } ,
273
+ 'nested' => { '$ref' => '#/definitions/TheseApi_Entities_Nested ' , 'description' => 'Nested object.' } ,
274
274
'code' => { 'type' => 'string' , 'description' => 'Error code' } ,
275
275
'message' => { 'type' => 'string' , 'description' => 'Error message' } ,
276
- 'polymorphic' => { '$ref' => '#/definitions/TheseApi::Entities::Polymorphic ' , 'description' => 'Polymorphic Model' } ,
276
+ 'polymorphic' => { '$ref' => '#/definitions/TheseApi_Entities_Polymorphic ' , 'description' => 'Polymorphic Model' } ,
277
277
'attr' => { 'type' => 'string' , 'description' => 'Attribute' }
278
278
} ,
279
279
'required' => %w[ attr ] ,
0 commit comments