ruby on rails - gem swagger-docs not generating apropriate json files to be displayed on swagger-ui -


swagger-ui not displaying docs , o dont know why. i'm using swagger-docs gem, generated api-docs.json, created route access index.html of swagger-ui, passed parameter path of api-docs.json result that:

swagger-ui index.html

could me?

config/initializers/swagger-docs.rb

swagger::docs::config.base_api_controller = actioncontroller::api  swagger::docs::config.register_apis({   "1.0" => {     # extension used api     :api_extension_type => :json,     # location our api doc files generated, of store files under public directory     :api_file_path => "public/docs",     # base path url of our application     # while using production mode, point production url     :base_path => "http://localhost:3000",     # setting option true tells swagger clean files generated in api_file_path directory before files generated     :clean_directory => true,     # using rails-api, our applicationcontroller inherits actioncontroller::api instead of actioncontroller::base     # hence, need add actioncontroller::api instead of default actioncontroller::base     # :base_api_controller => actioncontroller::api,     # parent_controller needs specified if api controllers inheriting other controller applicationcontroller     :parent_controller => actioncontroller::api,     :attributes => {       :info => {         "title" => "todos api demo",         "description" => "this documentation related todos api",         "contact" => "silva.danilo.nobre@gmail.com",         "license" => "apache 2.0",         "licenseurl" => "http://www.apache.org/licenses/license-2.0.html"       }     }   } }) 

public/docs/api-docs.json

{   "apiversion": "1.0",   "swaggerversion": "1.2",   "basepath": "http://localhost:3000",   "apis": [     {       "path": "/v2/todos.{format}",       "description": "todos management"     },     {       "path": "/v1/items.{format}",       "description": "item management"     },     {       "path": "/v1/todos.{format}",       "description": "todos management"     }   ],   "authorizations": null,   "info": {     "title": "todos api demo",     "description": "this documentation related todos api",     "contact": "silva.danilo.nobre@gmail.com",     "license": "apache 2.0",     "licenseurl": "http://www.apache.org/licenses/license-2.0.html"   } } 

public/docs/v1/todos.json

{   "apiversion": "1.0",   "swaggerversion": "1.2",   "basepath": "http://localhost:3000",   "resourcepath": "todos",   "apis": [     {       "path": "/todos.json",       "operations": [         {           "summary": "returns todos",           "notes": "implementation notes, such required params, example queries apis written here.",           "responsemessages": [             {               "code": 200,               "responsemodel": null,               "message": "ok"             }           ],           "nickname": "v1::todos#index",           "method": "get"         }       ]     },     {       "path": "/todos.json",       "operations": [         {           "summary": "create new todo item",           "notes": "notes creating new todo item",           "responsemessages": [             {               "code": 401,               "responsemodel": null,               "message": "unauthorized"             },             {               "code": 406,               "responsemodel": null,               "message": "not acceptable"             },             {               "code": 422,               "responsemodel": null,               "message": "unprocessable entity"             }           ],           "parameters": [             {               "paramtype": "form",               "name": "todo[title]",               "type": "string",               "description": "title",               "required": true             },             {               "paramtype": "form",               "name": "todo[created_by]",               "type": "string",               "description": "created by",               "required": true             }           ],           "nickname": "v1::todos#create",           "method": "post"         }       ]     },     {       "path": "/todos/{id}.json",       "operations": [         {           "summary": "fetches todo id",           "notes": "find todo id",           "responsemessages": [             {               "code": 401,               "responsemodel": null,               "message": "unauthorized"             },             {               "code": 406,               "responsemodel": null,               "message": "the request made not acceptable"             },             {               "code": 500,               "responsemodel": null,               "message": "requested range not satisfiable"             }           ],           "parameters": [             {               "paramtype": "path",               "name": "id",               "type": "integer",               "description": "todo id",               "required": false             }           ],           "nickname": "v1::todos#show",           "method": "get"         }       ]     },     {       "path": "/todos/{id}.json",       "operations": [         {           "summary": "updates existing todo item",           "responsemessages": [             {               "code": 401,               "responsemodel": null,               "message": "unauthorized"             },             {               "code": 404,               "responsemodel": null,               "message": "not found"             },             {               "code": 406,               "responsemodel": null,               "message": "not acceptable"             }           ],           "parameters": [             {               "paramtype": "path",               "name": "id",               "type": "integer",               "description": "user id",               "required": true             },             {               "paramtype": "form",               "name": "todo[title]",               "type": "string",               "description": "title",               "required": true             },             {               "paramtype": "form",               "name": "todo[created_by]",               "type": "string",               "description": "created by",               "required": true             }           ],           "nickname": "v1::todos#update",           "method": "patch"         }       ]     },     {       "path": "/todos/{id}.json",       "operations": [         {           "summary": "deletes existing todo item",           "responsemessages": [             {               "code": 401,               "responsemodel": null,               "message": "unauthorized"             },             {               "code": 404,               "responsemodel": null,               "message": "not found"             }           ],           "parameters": [             {               "paramtype": "path",               "name": "id",               "type": "integer",               "description": "user id",               "required": false             }           ],           "nickname": "v1::todos#destroy",           "method": "delete"         }       ]     }   ],   "authorizations": null } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -