Stream: hapi
Topic: unexpected (strange) validate() behaviour in client
Michael Lawley (May 17 2016 at 04:21):
Hi @James Agnew When I run the following code (HAPI 1.6-SNAPSHOT) with a resource that hasId(), it ends up calling validate on the instance (which doesn't exist) rather than on the type and supplying the instance. I think this is a bug?
client
.validate()
.resource(resource)
.encodedJson()
.execute();
James Agnew (May 17 2016 at 21:34):
Oh interesting. Yeah, I suppose that validate-by-type is the most reasonable default behaviour for that method.
I wonder what would be a good API for validate-by-ID though if we changed that?
client.validate().resource(resource).withId(id).execute()
perhaps?
Michael Lawley (May 17 2016 at 23:29):
What would be the resource in that case? I would have expected client.validate().withId(id).execute()
I'm also looking for how to provide the additional optional parameters (eg Mode)
Michael Lawley (May 17 2016 at 23:30):
BTW client.validate().resource(resource).execute()
works just fine if you remove the id :-)
Last updated: Apr 12 2022 at 19:14 UTC