@@ -20,7 +20,7 @@ def app
2020 'description' => 'OK' ,
2121 'schema' => {
2222 'type' => 'array' ,
23- 'items' => { '$ref' => '#/definitions/ThisApi::Entities::Something ' }
23+ 'items' => { '$ref' => '#/definitions/ThisApi_Entities_Something ' }
2424 }
2525 }
2626 )
@@ -30,15 +30,15 @@ def app
3030 expect ( subject [ 'paths' ] [ '/something/{id}' ] [ 'get' ] [ 'responses' ] ) . to eq (
3131 '200' => {
3232 'description' => 'OK' ,
33- 'schema' => { '$ref' => '#/definitions/ThisApi::Entities::Something ' }
33+ 'schema' => { '$ref' => '#/definitions/ThisApi_Entities_Something ' }
3434 } ,
3535 '403' => {
3636 'description' => 'Refused to return something' ,
37- 'schema' => { '$ref' => '#/definitions/ThisApi::Entities::Error ' }
37+ 'schema' => { '$ref' => '#/definitions/ThisApi_Entities_Error ' }
3838 }
3939 )
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 (
4242 'type' => 'object' ,
4343 'description' => 'This returns something or an error' ,
4444 'properties' => {
@@ -47,36 +47,36 @@ def app
4747 }
4848 )
4949
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 (
5252 'type' => 'object' ,
5353 'description' => 'This returns something' ,
5454 'properties' =>
5555 { 'text' => { 'type' => 'string' , 'description' => 'Content of something.' } ,
5656 '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.' } ,
6262 'code' => { 'type' => 'string' , 'description' => 'Error code' } ,
6363 'message' => { 'type' => 'string' , 'description' => 'Error message' } ,
6464 'attr' => { 'type' => 'string' , 'description' => 'Attribute' } } ,
6565 'required' => [ 'attr' ]
6666 )
6767
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 (
7070 'type' => 'object' , 'properties' => { 'title' => { 'type' => 'string' , 'description' => 'Title of the kind.' } , 'content' => { 'description' => 'Content' , 'type' => 'string' , 'x-some' => 'stuff' } }
7171 )
7272
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 (
7575 'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'Name' } }
7676 )
7777
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 (
8080 'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'Name' } }
8181 )
8282 end
@@ -140,11 +140,11 @@ class Polymorphic < Grape::Entity
140140
141141 class SomeEntity < Grape ::Entity
142142 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.' }
144144 expose :kind2 , using : Kind , documentation : { desc : 'Secondary kind.' }
145145 expose :kind3 , using : TheseApi ::Entities ::Kind , documentation : { desc : 'Tertiary kind.' }
146146 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.' }
148148 expose :values , using : TheseApi ::Entities ::Values , documentation : { desc : 'Tertiary kind.' }
149149 expose :nested , using : TheseApi ::Entities ::Nested , documentation : { desc : 'Nested object.' }
150150 expose :polymorphic , using : TheseApi ::Entities ::Polymorphic , documentation : { desc : 'Polymorphic Model' }
@@ -177,28 +177,28 @@ def app
177177 end
178178
179179 it 'prefers entity over other `using` values' do
180- expect ( subject [ 'TheseApi::Entities::Values ' ] ) . to eql (
180+ expect ( subject [ 'TheseApi_Entities_Values ' ] ) . to eql (
181181 'type' => 'object' ,
182182 'properties' => {
183183 'guid' => { 'type' => 'string' , 'enum' => %w[ a b c ] , 'default' => 'c' , 'description' => 'Some values' } ,
184184 'uuid' => { 'type' => 'string' , 'format' => 'own' , 'description' => 'customer uuid' , 'example' => 'e3008fba-d53d-4bcc-a6ae-adc56dff8020' }
185185 }
186186 )
187- expect ( subject [ 'TheseApi::Entities::Kind ' ] ) . to eql (
187+ expect ( subject [ 'TheseApi_Entities_Kind ' ] ) . to eql (
188188 'type' => 'object' ,
189189 'properties' => {
190190 'id' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'id of the kind.' , 'enum' => [ 1 , 2 ] , 'readOnly' => true } ,
191191 'title' => { 'type' => 'string' , 'description' => 'Title of the kind.' , 'readOnly' => false } ,
192192 'type' => { 'type' => 'string' , 'description' => 'Type of the kind.' , 'readOnly' => true }
193193 }
194194 )
195- expect ( subject [ 'TheseApi::Entities::Tag ' ] ) . to eql (
195+ expect ( subject [ 'TheseApi_Entities_Tag ' ] ) . to eql (
196196 'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'Name' , 'example' => 'random_tag' } }
197197 )
198- expect ( subject [ 'TheseApi::Entities::Relation ' ] ) . to eql (
198+ expect ( subject [ 'TheseApi_Entities_Relation ' ] ) . to eql (
199199 'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'Name' } }
200200 )
201- expect ( subject [ 'TheseApi::Entities::Nested ' ] ) . to eq (
201+ expect ( subject [ 'TheseApi_Entities_Nested ' ] ) . to eq (
202202 'properties' => {
203203 'nested' => {
204204 'type' => 'object' ,
@@ -250,30 +250,30 @@ def app
250250 } ,
251251 'type' => 'object'
252252 )
253- expect ( subject [ 'TheseApi::Entities::Polymorphic ' ] ) . to eql (
253+ expect ( subject [ 'TheseApi_Entities_Polymorphic ' ] ) . to eql (
254254 'type' => 'object' ,
255255 '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' } ,
258258 'str' => { 'type' => 'string' , 'description' => 'Polymorphic String' } ,
259259 'num' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'Polymorphic Number' }
260260 }
261261 )
262262
263- expect ( subject [ 'TheseApi::Entities::SomeEntity ' ] ) . to eql (
263+ expect ( subject [ 'TheseApi_Entities_SomeEntity ' ] ) . to eql (
264264 'type' => 'object' ,
265265 'properties' => {
266266 '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.' } ,
274274 'code' => { 'type' => 'string' , 'description' => 'Error code' } ,
275275 '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' } ,
277277 'attr' => { 'type' => 'string' , 'description' => 'Attribute' }
278278 } ,
279279 'required' => %w[ attr ] ,
0 commit comments