55require 'grape-swagger/endpoint/params_parser'
66
77module Grape
8- class Endpoint
8+ module OpenAPI3Endpoint
99 def content_types_for ( target_class )
1010 content_types = ( target_class . content_types || { } ) . values
1111
@@ -30,10 +30,10 @@ def swagger_object(_target_class, request, options)
3030 servers = servers . is_a? ( Hash ) ? [ servers ] : servers
3131
3232 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 ] ,
3737 servers : servers
3838 }
3939
@@ -50,12 +50,12 @@ def swagger_object(_target_class, request, options)
5050 # building info object
5151 def info_object ( infos )
5252 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 ]
5959 }
6060
6161 GrapeSwagger ::DocMethods ::Extensions . add_extensions_to_info ( infos , result )
@@ -68,7 +68,7 @@ def info_object(infos)
6868 def license_object ( infos )
6969 {
7070 name : infos . delete ( :license ) ,
71- url : infos . delete ( :license_url )
71+ url : infos . delete ( :license_url )
7272 } . delete_if { |_ , value | value . blank? }
7373 end
7474
@@ -202,11 +202,11 @@ def params_object(route, options, path)
202202 elsif value [ :documentation ]
203203 expose_params ( value [ :documentation ] [ :type ] )
204204 end
205- GrapeSwagger ::DocMethods ::ParseParams . call ( param , value , path , route , @definitions )
205+ GrapeSwagger ::DocMethods ::OpenAPIParseParams . call ( param , value , path , route , @definitions )
206206 end
207207
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 )
210210 end
211211
212212 parameters
0 commit comments