diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2018-04-27 19:59:41 +0300 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2018-04-27 19:59:41 +0300 |
| commit | 03e592b13370791a0839615257d4c57a3eb0bee8 (patch) | |
| tree | 9c62ee6c9c1fb8938c8a0a6bde1f64f47ab7a98e | |
| parent | 44b39c7f5cdd93065d653a1428f9bd3c6f56618b (diff) | |
| download | nimpb-03e592b13370791a0839615257d4c57a3eb0bee8.tar.gz nimpb-03e592b13370791a0839615257d4c57a3eb0bee8.zip | |
Fix JSON parsing of more WKTs
See the commit 44b39c7 for more information.
| -rw-r--r-- | nimpb/wkt/struct.nim | 12 | ||||
| -rw-r--r-- | nimpb/wkt/timestamp.nim | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/nimpb/wkt/struct.nim b/nimpb/wkt/struct.nim index 12427b2..659af58 100644 --- a/nimpb/wkt/struct.nim +++ b/nimpb/wkt/struct.nim @@ -53,17 +53,17 @@ proc parsegoogle_protobuf_Value*(node: JsonNode): google_protobuf_Value = result = newgoogle_protobuf_Value() if node.kind == JNull: - result.nullValue = google_protobuf_NullValue.NULL_VALUE + setNullValue(result, google_protobuf_NullValue.NULL_VALUE) elif node.kind == JInt or node.kind == JFloat: - result.numberValue = getFloat(node) + setNumberValue(result, getFloat(node)) elif node.kind == JString: - result.stringValue = getStr(node) + setStringValue(result, getStr(node)) elif node.kind == JBool: - result.boolValue = getBool(node) + setBoolValue(result, getBool(node)) elif node.kind == JObject: - result.structValue = parsegoogle_protobuf_Struct(node) + setStructValue(result, parsegoogle_protobuf_Struct(node)) elif node.kind == JArray: - result.listValue = parsegoogle_protobuf_ListValue(node) + setListValue(result, parsegoogle_protobuf_ListValue(node)) proc parsegoogle_protobuf_NullValue*(node: JsonNode): google_protobuf_NullValue = if node.kind != JNull: diff --git a/nimpb/wkt/timestamp.nim b/nimpb/wkt/timestamp.nim index 3df18b5..16134e3 100644 --- a/nimpb/wkt/timestamp.nim +++ b/nimpb/wkt/timestamp.nim @@ -69,5 +69,5 @@ offset <- 'Z' / (('+' / '-') \d\d ':' \d\d) result = newgoogle_protobuf_Timestamp() - result.seconds = toUnix(toTime(dt)) - result.nanos = int32(nanos) + setSeconds(result, toUnix(toTime(dt))) + setNanos(result, int32(nanos)) |
