-
Notifications
You must be signed in to change notification settings - Fork 28
SwaggerDoc doesn't work #2
Comments
can you show us the Route definition? does it specify .Writes(Cpuinfo{}) .
?
…On Wed, Mar 8, 2017 at 4:33 AM, eliqiao ***@***.***> wrote:
I have follow codes:
type Cpuinfo struct {
Id string json:"socket_id,omitempty"
Cpus string json:"cpus,omitempty"
}
...
and defined:
func (cpuinfo CpuinfoResource) SwaggerDoc() map[string]string {
return map[string]string{
"": "Cpuinfo doc",
"socket_id": "ID of physical CPU socket",
"cpus": "Cpu list which sits on this socket",
}
}
but seems the doc is not generated at all
http://localhost:8081/apidocs.json
{
"swaggerVersion": "1.2",
"apis": [
{
"path": "/v1/cpuinfo",
"description": "Show the cupinfo of a host."
}
],
"apiVersion": "1.0",
"info": {
"title": "",
"description": ""
}
}
doesn't find anything doc information in swagger UI
Am I missing something
[image: screen shot 2017-03-08 at 11 34 32 am]
<https://cloud.githubusercontent.com/assets/1592588/23689060/194cac9a-03f3-11e7-8af8-5071d3c12d8b.png>
?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAp4jKpcpdWjm01vnFdez5hkQZg8EOrEks5rjiGjgaJpZM4MWU6d>
.
--
Met vriendelijke groet,
^ Ernest Micklei
ernestmicklei.com
|
Yes, it does. type Cpuinfo struct { func (cpuinfo CpuinfoResource) Register(container *restful.Container) {
} // GET http://localhost:8081/cpuinfo/
} // GET http://localhost:8081/cpuinfo/{socket_id} func (cpuinfo CpuinfoResource) getSocketId(request *restful.Request, response *restful.Response) {
} The apidocs.json is: { |
what does /apidocs.json/v1/cpuinfo show ? |
{ |
SwaggerDoc must be defined on the struct, not the Resource |
were you able to fix this? can this be closed? |
delete os.stdout
I have follow codes:
type Cpuinfo struct {
Id string
json:"socket_id,omitempty"
Cpus string
json:"cpus,omitempty"
}
...
and defined:
func (cpuinfo CpuinfoResource) SwaggerDoc() map[string]string {
return map[string]string{
"": "Cpuinfo doc",
"socket_id": "ID of physical CPU socket",
"cpus": "Cpu list which sits on this socket",
}
}
but seems the doc is not generated at all
http://localhost:8081/apidocs.json
{
"swaggerVersion": "1.2",
"apis": [
{
"path": "/v1/cpuinfo",
"description": "Show the cupinfo of a host."
}
],
"apiVersion": "1.0",
"info": {
"title": "",
"description": ""
}
}
doesn't find anything doc information in swagger UI
Am I missing something
?
The text was updated successfully, but these errors were encountered: