example: http://halform.herokuapp.com/
Last active
May 9, 2016 22:30
-
-
Save mikekelly/5086339 to your computer and use it in GitHub Desktop.
what forms could look like in halo
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
# Form Properties | |
title | |
description | |
target | |
method | |
headers | |
fields | |
fielsets ?? | |
# Shared Field Properties | |
type | |
validators | |
title | |
help | |
# Field Types | |
Text | |
Number | |
Password | |
TextArea | |
Checkbox | |
Checkboxes | |
Hidden | |
Select | |
Radio | |
Date | |
DateTime | |
List | |
Object | |
# Field Validators | |
required | |
url | |
match | |
regexp |
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
{ | |
"_links": { "self": { "href": "/users" } }, | |
"_forms": { | |
"create-user": { | |
"title": "Create a new widget", | |
"description": "Enter your widget info and submit to create a new widget", | |
"target": "/widgets/{id}", | |
"method": "PUT", | |
"headers": { | |
"Content-Type": "application/json" | |
}, | |
"fields": { | |
"name": { "type": "Text", "validators": [ "required" ] }, | |
"email": { "type": "Text", "validators": [ "required", "email" ] }, | |
"age": { "type": "Number" }, | |
"homepage": { "type": "Text", "dataType": "url", "validators": [ "url" ] }, | |
"password": { "type": "Password" }, | |
"likes": { "type": "Checkboxes", "options": [ "Computers", "Combat", "Cats" ] }, | |
"ninja": { "type": "Hidden", "value": "This is a hidden field" }, | |
"size": { "type": "Select", "options": [ "large", "small" ] }, | |
"has_answer": { "type": "Radio", "options": [ "yes", "no", "wtf" ] }, | |
"dob": { "type": "Date" }, | |
"favourite_datetime": { "type": "DateTime" }, | |
"things_to_do_before_death": { "type": "List" } | |
} | |
} | |
} | |
} |
@mikekelly Presume you are aware of this: http://tools.ietf.org/html/rfc6861. I think it would be useful to consider accommodating this so that one could actually externally define the form and thus look it up as you are working on controls for HALO. Given there is a spec and per my earlier comment on keeping things DRY, this would be a nice option to be able to use as well as whatever the full convention ends up being.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I understand that maybe @mikekelly wants to transparently load this JSON from a client-side JavaScript client and represent elements on screen, so that's why he set
Checkbox
at the form representation. I like that, but I agree that Checkbox does not reflects the object on the api.Maybe we can have a separated option for "interface suggestions"?
This can be entirely optional and simply ignored on backend integration (let's say an API to API integration), but is really relevant when you want to dynamically load a resource and represent it on screen.
Not sure if "interface" is the best name -- maybe "suggested_representation"?