-
Notifications
You must be signed in to change notification settings - Fork 24
Fix KVGetResult scheme to match Consul API #13
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the slow response. I took a vacation, and then my motherboard took a vacation after that.
@@ -5,7 +5,7 @@ import argonaut._, Argonaut._ | |||
/** Case class representing the response to a KV "Read Key" API call to Consul */ | |||
final case class KVGetResult( | |||
key: String, | |||
value: String, | |||
value: Option[String], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be a binary breaking change and require another major version, though I can't think of a better way. It would probably be incorrect and/or evil to conflate the empty string with a null value here.
@aldiyen, do you have any thoughts here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh interesting, the Consul documentation doesn't seem to say anything about that. I cannot think of any better alternative either.
I think either kvGetRaw
or kvGetJson
needs to change as well to handle the null value in Consul's KV store situation, as I suspect that kvGetRaw
will return Some(Array())
and then the JSON parsing will blow up, which seems more confusing than having kvGetJson
spit out a None
. I haven't tested this theory though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolutely right. Corrected this case.
This looks like it'll work to me. |
I feel terrible for the delay on this. Please don't hesitate to give me a nudge if I'm this unresponsive. |
Actually
Value
field in Consul API is optional and deserialization fails if key value is null.curl -X PUT localhost:8500/v1/kv/foo/
true
curl localhost:8500/v1/kv/foo/