Files
scylladb/apps/httpd/demo.json
Amnon Heiman 006b061aba Adding hello world swagger demo
This demonstrate how to use a swagger definition file to create an API.

The swagger file demo.json define one api called hello_world, it has
both query and path parameters and return an object as a result.

The handler implementation simply places the given parameters in the
return object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00

74 lines
2.4 KiB
JSON

{
"apiVersion": "0.0.1",
"swaggerVersion": "1.2",
"basePath": "{{Protocol}}://{{Host}}",
"resourcePath": "/hello",
"produces": [
"application/json"
],
"apis": [
{
"path": "/hello/world/{var1}/{var2}",
"operations": [
{
"method": "GET",
"summary": "Returns the number of seconds since the system was booted",
"type": "long",
"nickname": "hello_world",
"produces": [
"application/json"
],
"parameters": [
{
"name":"var2",
"description":"Full path of file or directory",
"required":true,
"allowMultiple":true,
"type":"string",
"paramType":"path"
},
{
"name":"var1",
"description":"Full path of file or directory",
"required":true,
"allowMultiple":false,
"type":"string",
"paramType":"path"
},
{
"name":"query_enum",
"description":"The operation to perform",
"required":true,
"allowMultiple":false,
"type":"string",
"paramType":"query",
"enum":["VAL1", "VAL2", "VAL3"]
}
]
}
]
}
],
"models" : {
"my_object": {
"id": "my_object",
"description": "Demonstrate an object",
"properties": {
"var1": {
"type": "string",
"description": "The first parameter in the path"
},
"var2": {
"type": "string",
"description": "The second parameter in the path"
},
"enum_var" : {
"type": "string",
"description": "Demonstrate an enum returned, note this is not the same enum type of the request",
"enum":["VAL1", "VAL2", "VAL3"]
}
}
}
}
}