5
5
require 'grape-swagger/endpoint/params_parser'
6
6
7
7
module Grape
8
- class Endpoint
8
+ module OpenAPI3Endpoint
9
9
def content_types_for ( target_class )
10
10
content_types = ( target_class . content_types || { } ) . values
11
11
@@ -30,10 +30,10 @@ def swagger_object(_target_class, request, options)
30
30
servers = servers . is_a? ( Hash ) ? [ servers ] : servers
31
31
32
32
object = {
33
- info : info_object ( options [ :info ] . merge ( version : options [ :doc_version ] ) ) ,
34
- openapi : '3.0.0' ,
35
- security : options [ :security ] ,
36
- authorizations : options [ :authorizations ] ,
33
+ info : info_object ( options [ :info ] . merge ( version : options [ :doc_version ] ) ) ,
34
+ openapi : '3.0.0' ,
35
+ security : options [ :security ] ,
36
+ authorizations : options [ :authorizations ] ,
37
37
servers : servers
38
38
}
39
39
@@ -50,12 +50,12 @@ def swagger_object(_target_class, request, options)
50
50
# building info object
51
51
def info_object ( infos )
52
52
result = {
53
- title : infos [ :title ] || 'API title' ,
54
- description : infos [ :description ] ,
55
- termsOfService : infos [ :terms_of_service_url ] ,
56
- contact : contact_object ( infos ) ,
57
- license : license_object ( infos ) ,
58
- version : infos [ :version ]
53
+ title : infos [ :title ] || 'API title' ,
54
+ description : infos [ :description ] ,
55
+ termsOfService : infos [ :terms_of_service_url ] ,
56
+ contact : contact_object ( infos ) ,
57
+ license : license_object ( infos ) ,
58
+ version : infos [ :version ]
59
59
}
60
60
61
61
GrapeSwagger ::DocMethods ::Extensions . add_extensions_to_info ( infos , result )
@@ -68,7 +68,7 @@ def info_object(infos)
68
68
def license_object ( infos )
69
69
{
70
70
name : infos . delete ( :license ) ,
71
- url : infos . delete ( :license_url )
71
+ url : infos . delete ( :license_url )
72
72
} . delete_if { |_ , value | value . blank? }
73
73
end
74
74
@@ -202,11 +202,11 @@ def params_object(route, options, path)
202
202
elsif value [ :documentation ]
203
203
expose_params ( value [ :documentation ] [ :type ] )
204
204
end
205
- GrapeSwagger ::DocMethods ::ParseParams . call ( param , value , path , route , @definitions )
205
+ GrapeSwagger ::DocMethods ::OpenAPIParseParams . call ( param , value , path , route , @definitions )
206
206
end
207
207
208
- if GrapeSwagger ::DocMethods ::MoveParams . can_be_moved? ( parameters , route . request_method )
209
- parameters = GrapeSwagger ::DocMethods ::MoveParams . to_definition ( path , parameters , route , @definitions )
208
+ if GrapeSwagger ::DocMethods ::OpenAPIMoveParams . can_be_moved? ( parameters , route . request_method )
209
+ parameters = GrapeSwagger ::DocMethods ::OpenAPIMoveParams . to_definition ( path , parameters , route , @definitions )
210
210
end
211
211
212
212
parameters
0 commit comments