This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": 123, | |
"title": "Example data", | |
"actions": { | |
"confirmAddress": "/item/123/confirmAddress", | |
"edit": "/item/123", | |
"addComment": "/item/123/comments" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.unique = function () { | |
// make sure we have a unique string that is not a defined key in any object | |
var uniqueString = "" + Math.random(); | |
for (var i = 0; i < this.length; i++) { | |
if (typeof this[i] == "object" && this[i][uniqueString] != undefined) { | |
uniqueString = "" + Math.random(); | |
i = -1; | |
continue; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Error (HTTP)", | |
"type": "object", | |
"properties": { | |
"statusCode": {"type": "integer"}, | |
"statusText": {"type": "string"}, | |
"message": {"type": "string"}, | |
"data": {"title": "Supplementary data"} | |
}, | |
"required": ["statusCode", "statusText", "message"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function matchUriTemplate($template, $pathInfo=NULL, $stripQuery=TRUE) { | |
$params = array(); | |
if ($pathInfo == NULL) { | |
$pathInfo = $_SERVER['PATH_INFO']; | |
} | |
if ($stripQuery) { | |
$pos = strpos($pathInfo, "?"); | |
if ($pos !== FALSE) { | |
$pathInfo = substr($pathInfo, 0, $pos); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('json-utils.php'); | |
abstract class DbData { | |
abstract public function loadFromRow($row); | |
public static function match($template) { | |
$params = array(); | |
$pathInfo = $_SERVER['PATH_INFO']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"properties": { | |
"someProperty": { | |
"id": "http://other.site/schema", | |
"type": "array", | |
"items": {"$ref": "itemSchema"} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Some schema", | |
"items": { | |
"id": "http://example.com/other-schema", | |
"type": "array", | |
"items": {"$ref": "#"} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"responseStatus": { | |
"status": "success", | |
"message": "This is a valid message" | |
}, | |
"data": { | |
"total": 2, | |
"collection": [ | |
{ | |
"id": 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"items": { | |
"allOf": [ | |
{...} | |
] | |
}, | |
"definitions": { | |
"myFragment": {"$ref": "#/items/allOf/0"} | |
} | |
} |
OlderNewer