Created
November 4, 2013 13:20
-
-
Save CharlotteGore/7302318 to your computer and use it in GitHub Desktop.
Controls proposal
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
editresource : { | |
method : "PUT", | |
action : "/someaction", | |
encoding: "x-form-www-encoding" | |
properties : { | |
"username" : "Current Username", | |
"email" : "current@user.com", | |
"etag" : "123j123j1llkj31ljflkjsdlkj32lkjlkjf", | |
"things" : [1, 2] | |
}, | |
schema : { | |
"username" : { | |
type : "Text", | |
validators : [ | |
required : true, | |
pattern : /[A-Za-z0-9\s]/ | |
] | |
}, | |
"email" : { | |
type : "Email", | |
validators : [ | |
required : false | |
] | |
}, | |
"etag" : { | |
type : "Hidden", | |
validators : [ | |
required : true, | |
pattern : /[A-Za-z0-9\s]/ | |
] | |
}, | |
"things" : { | |
type : "SelectMany", | |
validators : [ | |
required: true | |
], | |
options : [ | |
{ | |
value : 1, | |
description : "Option one" | |
}, | |
{ | |
value : 2, | |
description : "Option two" | |
}, | |
{ | |
value : 3, | |
description : "Option three" | |
} | |
] | |
/* | |
// or this could actually be... | |
options : [1, 2, 3] | |
// which would just generate <option value="1">1</option> | |
*/ | |
} | |
}, | |
enum : ["username", "email", "things", "etag"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi.
I'm currently looking into adding actions/forms to my HAL API and was wondering whether this solution has evolved since you posted it and if you've got any insights after using it in production.
I'm also thinking I'll use JSON Schema to describe options and payloads so I can reuse existing tools to generate and validate the schemas.