I am a newbie to swagger and i am stuck after doing the following things on an error:
I am using the following dependencies:
Following are the routes:

Following is the expected response type:
case class Output(response: JsValue)
This is the screenshot of where i am getting struck:

This is what i get in the auto generated json file(where it gets struck with error : fetching resource list):
{"paths":{"/assets/{file}":{"get":{"tags":["routes"],"parameters":[{"name":"path","type":"string","required":true,"in":"query"},{"name":"file","type":"asset","required":true,"in":"path"}]}},"/docs/swagger.json":{"get":{"tags":["routes"],"summary":"swagger definition","description":"for swagger UI to consume"}},"/client/view":{"get":{"tags":["routes"],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/models.Output"}}}}}},"definitions":{"models.Output":{"properties":{"response":{"type":"play.api.libs.json.jsvalue","required":true}},"required":["response"]}},"tags":[{"name":"routes"}]}
and this is my default swagger.json file(which i have created) :
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Weather API",
"description": "A sample API that uses a Mashape weather API as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://helloreverb.com/terms/",
"contact": {
"name": "Tom Johnson",
"email": "[email protected]",
"url": "localhost:9000"
},
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/MIT"
}
},
"host": "localhost:9000",
"basePath" : "localhost:9000",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/text"
]
}
I am refering to link : https://github.com/iheartradio/play-swagger
Hi! It seems your swagger.json file is incomplete.
It should have a "definitions" property defining the types used by your REST operations.
Actually i am using iheartradio/play-swagger : (https://github.com/iheartradio/play-swagger)
It only ask for minimum swagger.json file:
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Weather API",
"description": "A sample API that uses a Mashape weather API as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://helloreverb.com/terms/",
"contact": {
"name": "Tom Johnson",
"email": "[email protected]",
"url": "localhost:9000"
},
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/MIT"
}
},
"host": "localhost:9000",
"basePath": "/docs",
"schemes": [
"https",
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
]
}
and automatically generates the paths and definitions using the routes file.
Following is the demo project which i have created using the same:
https://github.com/SangeetaGulia/testSwagger
in brief:
These are the routes: # Routes

and these are the paths and definitions generated for my routes :
{
"paths":{
"/":{
"get":{
"tags":["routes"],
"responses":{
"200":{
"description":"success",
"schema":{
"$ref":"#/definitions/models.Test"
}
}
}
}
},
"/docs/swagger.json":{
"get":{
"tags":["routes"],
"summary":"swagger definition",
"description":"for swagger UI to consume"
}
}
},
"definitions":{
"models.Test":{
"properties":{
"name":{"type":"string"}
},
"required":["name"]
}
},
"tags":[{"name":"routes"}]
}
It contains definitions, but still i am getting the same error. Am i missing on something??
Is there any other way to auto generate the spec from my routes.??
Please try the latest version.
鎴戜篃閬囧埌浜嗗悓鏍风殑闂锛屾ゼ涓昏В鍐充簡涔堬紵
Most helpful comment
鎴戜篃閬囧埌浜嗗悓鏍风殑闂锛屾ゼ涓昏В鍐充簡涔堬紵