example/spas-input.apib.refract.json
{
"element": "parseResult",
"content": [
{
"element": "category",
"meta": {
"classes": [
"api"
],
"title": "Branda Test Case"
},
"attributes": {
"meta": [
{
"element": "member",
"meta": {
"classes": [
"user"
]
},
"content": {
"key": {
"element": "string",
"content": "FORMAT"
},
"value": {
"element": "string",
"content": "1A"
}
}
}
]
},
"content": [
{
"element": "copy",
"content": "This file is ought to be used as input to spas.\n\n"
},
{
"element": "category",
"meta": {
"classes": [
"resourceGroup"
],
"title": ""
},
"content": [
{
"element": "resource",
"meta": {
"title": "Camera Collection"
},
"attributes": {
"href": "/cameras"
},
"content": [
{
"element": "transition",
"meta": {
"title": "Get All cameras"
},
"content": [
{
"element": "copy",
"content": "Test case for the text/plain validator.\nThe api output must match exactly when it is used.\n\n"
},
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "200",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "text/plain"
}
}
}
]
}
},
"content": [
{
"element": "copy",
"content": "Simulate a rather long text/plain error"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "text/plain"
},
"content": "- Canon 80D\n- Panasonic GH4\n- Something\n- Other\n- to\n- repeat\n- Canon 80D\n- Panasonic GH4\n- Something\n- Other\n- to\n- repeat\n- Canon 80D\n- Panasonic GH4\n- Something\n- Other\n- to\n- repeat\n- Canon 80D\n- Panasonic GH4\n- Something\n- Other\n- to\n- repeat\n- Canon 80D\n- Panasonic GH4\n- Something\n- Other\n- to\n- repeat\n- Canon 80D\n- Panasonic GH4\n- Something\n- Other\n- to\n- repeat\n- Canon 80D\n- Panasonic GH4\n- Something\n- Other\n"
}
]
}
]
}
]
},
{
"element": "transition",
"meta": {
"title": "Add Camera"
},
"content": [
{
"element": "copy",
"content": "Test case for the no content validator.\n\n"
},
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"meta": {
"title": "Add Camera"
},
"attributes": {
"method": "POST",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Camera"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"id\": \"cf4536\",\n \"model\": \"80D\",\n \"vendor\": \"Canon\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"model\": {\n \"type\": \"string\"\n },\n \"vendor\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"model\",\n \"vendor\"\n ]\n}"
}
]
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "201",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Camera"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"id\": \"cf4536\",\n \"model\": \"80D\",\n \"vendor\": \"Canon\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"model\": {\n \"type\": \"string\"\n },\n \"vendor\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"model\",\n \"vendor\"\n ]\n}"
}
]
}
]
}
]
}
]
},
{
"element": "resource",
"meta": {
"title": ""
},
"attributes": {
"href": "/cameras/{id}"
},
"content": [
{
"element": "transition",
"meta": {
"title": ""
},
"attributes": {
"hrefVariables": {
"element": "hrefVariables",
"content": [
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "id"
},
"value": {
"element": "string",
"content": "5645s"
}
}
}
]
}
},
"content": [
{
"element": "copy",
"content": "Test case for json schema validator.\n\n"
},
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "200",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Camera"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"id\": \"cf4536\",\n \"model\": \"80D\",\n \"vendor\": \"Canon\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"model\": {\n \"type\": \"string\"\n },\n \"vendor\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"model\",\n \"vendor\"\n ]\n}"
}
]
}
]
}
]
}
]
},
{
"element": "resource",
"meta": {
"title": ""
},
"attributes": {
"href": "/exception"
},
"content": [
{
"element": "transition",
"meta": {
"title": ""
},
"content": [
{
"element": "copy",
"content": "Spas thinks this has to return a 200, but it will return a 500 \n\n"
},
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "200",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"type\": \"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\",\n \"title\": \"Bad Request\",\n \"detail\": \"Example exception\",\n \"code\": \"EXCEPTION_EXAMPLE\"\n}\n"
}
]
}
]
}
]
}
]
},
{
"element": "resource",
"meta": {
"title": ""
},
"attributes": {
"href": "/exception/pass"
},
"content": [
{
"element": "transition",
"meta": {
"title": ""
},
"content": [
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "500",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Exception"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"type\": \"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\",\n \"title\": \"Bad Request\",\n \"detail\": \"Example exception\",\n \"code\": \"EXCEPTION_EXAMPLE\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"detail\": {\n \"type\": \"string\"\n },\n \"code\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"type\",\n \"title\",\n \"detail\",\n \"code\"\n ]\n}"
}
]
}
]
}
]
}
]
},
{
"element": "resource",
"meta": {
"title": ""
},
"attributes": {
"href": "/system/health"
},
"content": [
{
"element": "transition",
"meta": {
"title": ""
},
"content": [
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "200",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Health"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"version\": \"324cbh\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"version\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"version\"\n ]\n}"
}
]
}
]
}
]
}
]
},
{
"element": "resource",
"meta": {
"title": ""
},
"attributes": {
"href": "/polling"
},
"content": [
{
"element": "transition",
"meta": {
"title": ""
},
"content": [
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "202",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
},
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Retry-After"
},
"value": {
"element": "string",
"content": "1"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Poll"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"msg\": \"I am a polling set\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"msg\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"msg\"\n ]\n}"
}
]
}
]
},
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "200",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Poll"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"msg\": \"I am a polling set\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"msg\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"msg\"\n ]\n}"
}
]
}
]
}
]
}
]
},
{
"element": "resource",
"meta": {
"title": ""
},
"attributes": {
"href": "/polling/unsupported"
},
"content": [
{
"element": "transition",
"meta": {
"title": ""
},
"content": [
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "202",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
},
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Retry-After"
},
"value": {
"element": "string",
"content": "2016-11-02T14:51:53+01:00"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Poll"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"msg\": \"I am a polling set\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"msg\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"msg\"\n ]\n}"
}
]
}
]
},
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": "GET"
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": "200",
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "Poll"
}
]
},
{
"element": "asset",
"meta": {
"classes": [
"messageBody"
]
},
"attributes": {
"contentType": "application/json"
},
"content": "{\n \"msg\": \"I am a polling set\"\n}"
},
{
"element": "asset",
"meta": {
"classes": [
"messageBodySchema"
]
},
"attributes": {
"contentType": "application/schema+json"
},
"content": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"msg\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"msg\"\n ]\n}"
}
]
}
]
}
]
}
]
}
]
},
{
"element": "category",
"meta": {
"classes": [
"dataStructures"
]
},
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "object",
"meta": {
"id": "Camera"
},
"content": [
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "id"
},
"value": {
"element": "string",
"content": "cf4536"
}
}
},
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "model"
},
"value": {
"element": "string",
"content": "80D"
}
}
},
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "vendor"
},
"value": {
"element": "string",
"content": "Canon"
}
}
}
]
}
]
},
{
"element": "dataStructure",
"content": [
{
"element": "object",
"meta": {
"id": "Exception"
},
"content": [
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "type"
},
"value": {
"element": "string",
"content": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}
}
},
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "title"
},
"value": {
"element": "string",
"content": "Bad Request"
}
}
},
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "detail"
},
"value": {
"element": "string",
"content": "Example exception"
}
}
},
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "code"
},
"value": {
"element": "string",
"content": "EXCEPTION_EXAMPLE"
}
}
}
]
}
]
},
{
"element": "dataStructure",
"content": [
{
"element": "object",
"meta": {
"id": "Health"
},
"content": [
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "version"
},
"value": {
"element": "string",
"content": "324cbh"
}
}
}
]
}
]
},
{
"element": "dataStructure",
"content": [
{
"element": "object",
"meta": {
"id": "Poll"
},
"content": [
{
"element": "member",
"attributes": {
"typeAttributes": [
"required"
]
},
"content": {
"key": {
"element": "string",
"content": "msg"
},
"value": {
"element": "string",
"content": "I am a polling set"
}
}
}
]
}
]
}
]
}
]
}
]
}