I'm getting "No QueryString binder found for type Option[java.util.UUID]" even though I have an implicit QueryStringBinder for UUID in scope. Do I need to create a separate binder for Option[UUID]? How does Play's bindableOption work then?
Here's the compiler output
[error] /Users/drew/Projects/Shopper/workspace/Shopper/target/scala-2.9.1/src_manag ed/main/routes_reverseRouting.scala:231: No QueryString binder found for type Option[java.util.UUID]. Try to implement an implicit QueryStringBindable for this type.
[error] Call("GET", Routes.prefix + { if(Routes.prefix.endsWith("/")) "" else "/" } + "api/circles/" + implicitly[PathBindable[UUID]].unbind("cid", cid) + "/connections" + queryString(List(if(from == None) None else Some(implicitly[QueryStringBindable[Option[UUID]]].unbind("from", from)), if(limit == None) None else Some(implicitly[QueryStringBindable[Option[Int]]].unbind("limit", limit)))))
[error] ^
[error] /Users/drew/Projects/Shopper/workspace/Shopper/target/scala-2.9.1/src_manag ed/main/routes_reverseRouting.scala:893: No JavaScript litteral binder found for type Option[java.util.UUID]. Try to implement an implicit JavascriptLitteral for this type.
[error] return _wA({method:"GET", url:"""" + Routes.prefix + { if(Routes.prefix.endsWith("/")) "" else "/" } + """" + "api/circles/" + (""" + implicitly[PathBindable[UUID]].javascriptUnbind + """)("cid", cid) + "/connections" + _qS([(from == """ + implicitly[JavascriptLitteral[Option[UUID]]].to(None) + """ ? null : (""" + implicitly[QueryStringBindable[Option[UUID]]].javascriptUnbind + """)("from", from)), (limit == """ + implicitly[JavascriptLitteral[Option[Int]]].to(None) + """ ? null : (""" + implicitly[QueryStringBindable[Option[Int]]].javascriptUnbind + """)("limit", limit))])})
[error] ^
[error] /Users/drew/Projects/Shopper/workspace/Shopper/target/scala-2.9.1/src_manag ed/main/routes_routing.scala:537: No QueryString binder found for type Option[java.util.UUID]. Try to implement an implicit QueryStringBindable for this type.
[error] call(params.fromPath[UUID]("cid", None), params.fromQuery[Option[UUID]]("from", Some(None)), params.fromQuery[Option[Int]]("limit", Some(None))) { (cid, from, limit) =>
[error] ^
I'm importing a QueryStringBindable[UUID] using routesImport in Build.scala. I also looked at the generated Routes Scala class and my imports were imported at the top. I even tried making a QueryStringBindable[Option[UUID]] and that didn't work also. I pretty much followed your blog post regarding PathBindables. Are QueryStringBindables any different?
- Drew
On May 1, 2012, at 12:52 AM, Julien Richard-Foy <j...@zenexity.com> wrote:
> Hi,
> It should work. How are you sure there is an implicit
> QueryStringBindable[UUID] available in your scope?
> Regards.
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-framework@googlegroups.com.
> To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
It should work, can you paste the code showing how is the
QueryStringBindable defined (including its package declaration) and
how is the route defined?
On Tuesday, May 1, 2012 3:14:59 AM UTC-5, Julien Richard-Foy wrote:
> It should work, can you paste the code showing how is the > QueryStringBindable defined (including its package declaration) and > how is the route defined?
> On Tuesday, May 1, 2012 3:14:59 AM UTC-5, Julien Richard-Foy wrote:
>> It should work, can you paste the code showing how is the >> QueryStringBindable defined (including its package declaration) and >> how is the route defined?
If that doesn't work, then in target/scala-2.9.1/src_managed/main you should find the two compile routes files, routes_reverseRouting.scala and routes_routing.scala.
Can you check that your routes import is somewhere at the top of those files? If it is, then could you paste the logs of the compile error?
>> On Tuesday, May 1, 2012 3:14:59 AM UTC-5, Julien Richard-Foy wrote:
>>> It should work, can you paste the code showing how is the >>> QueryStringBindable defined (including its package declaration) and >>> how is the route defined?
[info] Compiling 3 Scala sources and 2 Java sources to /Users/andres/source/plaor-git/hwp-bi/target/scala-2.9.1/classes... [error] /Users/andres/source/plaor-git/hwp-bi/target/scala-2.9.1/src_managed/main/r outes_reverseRouting.scala:68: No QueryString binder found for type org.joda.time.DateTime. Try to implement an implicit QueryStringBindable for this type. [error] Call("GET", "/tables/clicks" + queryString(List(Some(implicitly[QueryStringBindable[org.joda.time.DateTime ]].unbind("startDateTime", startDateTime))))) [error] ^ [error] /Users/andres/source/plaor-git/hwp-bi/target/scala-2.9.1/src_managed/main/r outes_reverseRouting.scala:220: No QueryString binder found for type org.joda.time.DateTime. Try to implement an implicit QueryStringBindable for this type. [error] return _wA({method:"GET", url:"/tables/clicks" + _qS([(""" + implicitly[QueryStringBindable[org.joda.time.DateTime]].javascriptUnbind + """)("startDateTime", startDateTime)])}) [error] ^ [error] /Users/andres/source/plaor-git/hwp-bi/target/scala-2.9.1/src_managed/main/r outes_routing.scala:96: No QueryString binder found for type org.joda.time.DateTime. Try to implement an implicit QueryStringBindable for this type. [error] call(params.fromQuery[org.joda.time.DateTime]("startDateTime", None)) { (startDateTime) => [error] ^ [error] three errors found [error] {file:/Users/andres/source/plaor-git/hwp-bi/}hwp-bi/compile:compile: Compilation failed [error] application -
! Internal server error, for request [GET /] ->
sbt.PlayExceptions$CompilationException: Compilation error [No QueryString binder found for type org.joda.time.DateTime. Try to implement an implicit QueryStringBindable for this type.] at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$4$$anonfun$apply$12$$an onfun$apply$13.apply(PlayReloader.scala:236) ~[na:na] at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$4$$anonfun$apply$12$$an onfun$apply$13.apply(PlayReloader.scala:236) ~[na:na] at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.3] at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$4$$anonfun$apply$12.app ly(PlayReloader.scala:236) ~[na:na] at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$4$$anonfun$apply$12.app ly(PlayReloader.scala:233) ~[na:na] at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.3]
It looks like the import isn't including the object in the import path:
On Wednesday, November 14, 2012 6:33:04 PM UTC-6, James Roper wrote:
> I think it actually should be:
> routesImport ++= "binders.CustomBinders._"
> If that doesn't work, then in target/scala-2.9.1/src_managed/main you > should find the two compile routes files, routes_reverseRouting.scala and > routes_routing.scala.
> Can you check that your routes import is somewhere at the top of those > files? If it is, then could you paste the logs of the compile error?
> On Wednesday, 14 November 2012 04:05:21 UTC+11, dres wrote:
>>> On Tuesday, May 1, 2012 3:14:59 AM UTC-5, Julien Richard-Foy wrote:
>>>> It should work, can you paste the code showing how is the >>>> QueryStringBindable defined (including its package declaration) and >>>> how is the route defined?
I figured it out, I think. The routes don't seem to get regenerated unless I run play clean. I had the wrong route like you pointed out but I had tried importing the object before and it didn't work. Thanks for pointing me to the generated scala code. It wasn't getting updated just by exiting the console and restarting play run. Is this a bug or expected behavior?
This is expected behaviour... the routes classes are regenerated if the routes file changes. Changing any configuration in Build.scala will usually require a clean to ensure that it takes effect.
On Saturday, 17 November 2012 03:19:00 UTC+11, dres wrote:
> I figured it out, I think. The routes don't seem to get regenerated > unless I run play clean. I had the wrong route like you pointed out but I > had tried importing the object before and it didn't work. Thanks for > pointing me to the generated scala code. It wasn't getting updated just by > exiting the console and restarting play run. Is this a bug or expected > behavior?
Any chance you would take a enhancement request to change that behavior? It
seems contrary to most development cycles to have to clean when the project
build file is changed IMHO. I'd at least like to contribute to the
documentation to clarify the lifecycle. I may have just missed but I
haven't seen much on the topic.
On Fri, Nov 16, 2012 at 7:59 PM, James Roper <jrop...@gmail.com> wrote:
> This is expected behaviour... the routes classes are regenerated if the
> routes file changes. Changing any configuration in Build.scala will
> usually require a clean to ensure that it takes effect.
> On Saturday, 17 November 2012 03:19:00 UTC+11, dres wrote:
>> I figured it out, I think. The routes don't seem to get regenerated
>> unless I run play clean. I had the wrong route like you pointed out but I
>> had tried importing the object before and it didn't work. Thanks for
>> pointing me to the generated scala code. It wasn't getting updated just by
>> exiting the console and restarting play run. Is this a bug or expected
>> behavior?
I don't think it is contrary... and I don't know any other build tools that work any different. For example, if you were using Maven, and you changed the target JVM version in the configuration, and then did a normal build, it wouldn't recompile anything. If you remove a dependency in SBT or maven, and then build, again, it won't recompile anything, it's not until you do a clean build that it breaks. The reason why things behave this way is that there's no way for the build tool to know which changes to your build configuration should require a clean build, only you can know this, so the build tool has two options, always do a clean build when the build configuration changes, or trust you to know what you're doing. Personally, I'd rather the build tool trust me and only do a (much slower) clean build when I tell it to.
On Sunday, 18 November 2012 10:38:28 UTC+11, dres wrote:
> Any chance you would take a enhancement request to change that behavior? > It seems contrary to most development cycles to have to clean when the > project build file is changed IMHO. I'd at least like to contribute to the > documentation to clarify the lifecycle. I may have just missed but I > haven't seen much on the topic.
> On Fri, Nov 16, 2012 at 7:59 PM, James Roper <jro...@gmail.com<javascript:> > > wrote:
>> This is expected behaviour... the routes classes are regenerated if the >> routes file changes. Changing any configuration in Build.scala will >> usually require a clean to ensure that it takes effect.
>> On Saturday, 17 November 2012 03:19:00 UTC+11, dres wrote:
>>> I figured it out, I think. The routes don't seem to get regenerated >>> unless I run play clean. I had the wrong route like you pointed out but I >>> had tried importing the object before and it didn't work. Thanks for >>> pointing me to the generated scala code. It wasn't getting updated just by >>> exiting the console and restarting play run. Is this a bug or expected >>> behavior?
I agree with your point about the build tool trusting the user and we can
leave it at that. But I think source code generation is a whole different
ball game than changing dependencies or runtime. In both your examples if
the source code had changed as it must for the routes, the code would be
recompiled. Just my perspective. Thanks again for your help.
On Sun, Nov 18, 2012 at 10:27 PM, James Roper <jrop...@gmail.com> wrote:
> I don't think it is contrary... and I don't know any other build tools
> that work any different. For example, if you were using Maven, and you
> changed the target JVM version in the configuration, and then did a normal
> build, it wouldn't recompile anything. If you remove a dependency in SBT
> or maven, and then build, again, it won't recompile anything, it's not
> until you do a clean build that it breaks. The reason why things behave
> this way is that there's no way for the build tool to know which changes to
> your build configuration should require a clean build, only you can know
> this, so the build tool has two options, always do a clean build when the
> build configuration changes, or trust you to know what you're doing.
> Personally, I'd rather the build tool trust me and only do a (much slower)
> clean build when I tell it to.
> On Sunday, 18 November 2012 10:38:28 UTC+11, dres wrote:
>> Any chance you would take a enhancement request to change that behavior?
>> It seems contrary to most development cycles to have to clean when the
>> project build file is changed IMHO. I'd at least like to contribute to the
>> documentation to clarify the lifecycle. I may have just missed but I
>> haven't seen much on the topic.
>> On Fri, Nov 16, 2012 at 7:59 PM, James Roper <jro...@gmail.com> wrote:
>>> This is expected behaviour... the routes classes are regenerated if the
>>> routes file changes. Changing any configuration in Build.scala will
>>> usually require a clean to ensure that it takes effect.
>>> On Saturday, 17 November 2012 03:19:00 UTC+11, dres wrote:
>>>> I figured it out, I think. The routes don't seem to get regenerated
>>>> unless I run play clean. I had the wrong route like you pointed out but I
>>>> had tried importing the object before and it didn't work. Thanks for
>>>> pointing me to the generated scala code. It wasn't getting updated just by
>>>> exiting the console and restarting play run. Is this a bug or expected
>>>> behavior?