-
Notifications
You must be signed in to change notification settings - Fork 21
Having trouble extracting a selectManyField #55
Comments
Can you please try the same with 0.4.0-SNAPSHOT? |
Will do. |
0.4.0-SNAPSHOT has the same behavior. |
I can put up a demo project to show what's going on, if that'll help. I'm not clear whether we are Doing It Wrong or whether there's a bug. |
that would be awesome, if you could put it somewhere on github. thanks :) |
On it. Back in 5. |
on it |
ok, looked at it and the thing is that if you have a select field, then the possible values are sent with indexes, not the actual ones - so you must send something like this:
which will then println
|
but then, client part of supler should be sending them properly - if that does not work, can you please publish your webapp? |
Aha! I see. We are only building the API right now, we haven't progressed to the point of building an HTML client for it (and it's not totally clear at the moment what clients will exist). The use of indexes does work, e.g. this: def main(args: Array[String]) {
val input = """{
"questionId": "55375f46d4c637a207558830",
"responses": [
"0"
]
}"""
val parsedBody = parse(input)
val form = ResponseForm.responseForm.withNewEmpty.applyJSONValues(parsedBody)
println(form.obj)
} Generates: Response(,55375f46d4c637a207558830,Set(yes)) So I can see what the problem was. Supler needs to be able to tie its allowable values to incoming data via indexes. I was under the impression that it'd just check whether input was in the @szimano, thanks very much for the help. Now I understand what's going on. |
Glad this helped. You are right, the indexes were the interim solution that have lasted till now. I've created #56 for this. Just out of curiosity - why are you planning on building your own HTML client? What is missing in the one we have created? |
It's not that we wouldn't use Supler for the front-end, just that we're not sure at the moment whether we'll be building an Android client, and iOS client, a SPA client, or what - we're in the very early stages and are just getting moving with a working API. We were discussing things internally, there are a couple of projects we've done in the past where Supler or something like it would really have helped us, so we'll definitely be trying out the front-end stuff soon. |
ok, fair enough. once i'm done with modals, iOS and/or android clients are next on my plate. |
You can provide a custom If an I'll have to update the docs later :) |
I'm building a little survey API which deals with Questions and Responses to those questions. Assuming I've got a
responseForm
with aselectManyField
which looks something like this:And I'm answer a Question such as "What sorts of flowers do you like?". I have a Response case class which looks like this:
I am having trouble extracting a Response object from the following input:
The json4s
parsedBody
of the incoming JSON looks like this:However the Supler extraction doesn't pull out the values for
responses
and put them in theSet
of responses.We do:
We end up with:
We would expect:
Are we doing something wrong? We're using Supler 0.3.0-SNAPSHOT.
The text was updated successfully, but these errors were encountered: