-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Collection+JSON template with options. #6
base: master
Are you sure you want to change the base?
Conversation
…ns: (array of prompt/value pair) and multiple: (boolan)
if multiple values are selected, I would say value should be an array, so processing would be strict JSON otherwise you would have to split elements by {"name" : "country", "value" : ["Germany", "Poland"], ...} |
I think "text" instead of prompt is ok, but "text" would need further description, whereas "prompt" within "options" is described by it's analogy to the "prompt" in data item. |
Currently, Also, why should the client return the entire hash ( |
[snip] Not sure what this means "further description" you mean that it adds a new property to CJ? or something else? |
The value extension seems to be a great way to handle multiple value in either an objet or an array. If that is indeed the solution from @hamnis I alos find "text" to be a better option as "prompt" or just returning "value". I could imagine a case where the value is "template" : {
"data" : [
{
"name" : "customer",
"value" : "",
"prompt" : "Customer",
"multiple" : "false",
"options" : [
{
"text" : "Jane",
"value" : "0z1a6" //value could be a customer id
},
{
"text" : "Joe",
"value" : "0b2c2"
}
]
}
]
} would the "text" field need to be described in the documentation somewhere? Or would it be self explanatory? |
updating to reflect conclusions drawn in this [pull request](mamund#6)
yes, the |
Update extensions/template-options.md
added a reference to value types and documentation for "text" and "value"
had single quotes where I should have double quotes
adding post and put examples
Update extensions/template-options.md add reference to value-types, showing POST/PUT request the actual state that is transferred from client to server (via POST or PUT) the resulting "item" that is returned from server to client
Hi @mamund just changed the structure or sequence of text blocs and published on gist. No objections to sorry for inconvenience, hope I understood everything fits now. I just followed the structure of the other extensions. |
thanks for the follow up and posting the gist. it looks pretty clear. style-wise, the content is just fine. anyone else want to weigh in here? is it OK w/ all that the {item} that is returned only shows the "text" and just making sure to cover all bases here. adding anything beyond simple On Wed, Sep 19, 2012 at 3:07 PM, kivi [email protected] wrote:
|
I would leave that optional. If respond contains the Example how a response could look like with "items" : [
{
"href" : "http://example.org/users/1",
"data" : [
{"name" : "username", "value" : "JDoe", "prompt" : "User name"},
{"name" : "country", "value" : "Germany", "prompt" : "Country"},
{"name" : "countryCode", "value" : "de", "prompt" : "Country"},
{"name" : "talents", "array" : ["socializing", "climbing"], "prompt" : "Talents"}
]
}
]
I thought to suggest a definition for Template:
"template" : {
"data" : [
{ "name" : "contact", "value" : "", "prompt" : "Contact", "required" : "true", "object" : {} }
]
}
POST/PUT
{ "contact" : { "github": "kivi", "twitter" : "chatmasala" } }
RESPONSE
...
{"name" : "contact", "object" : { "github": "kivi", "twitter" : "chatmasala" }, "prompt" : "Contact"}
... |
1. the template:{} (which you have above) 1. the actual body that will be sent via POST/PUT 1. the resulting item:{} 1. text and value as @mrdevinmob and @mamund mentioned in the group discussion
This appears to have gone cold, but none the less a related point: a similar construct for 'queries' would be a good idea, no? Ofc HTML as a media type can use |
yes, if we can come up w/ a stable extension for the data element that On Fri, Jul 26, 2013 at 5:28 AM, James Stephenson
|
This is not canon but we need it to move forward. Yes, this means you could do collection.items[n].data[y].options. Don't do that. hat tip: http://schinckel.net/2012/03/10/collection%2Bjson-primer-%28and-comments%29/ reference: mamund/collection-json#6
As talked about in here https://groups.google.com/d/msg/collectionjson/PQK5PoB7eSI/Tq2LZ_wr-_cJ
pull request by
User:mrdevinmob
User:kivi