-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
the following change was made to our schema
@live
and input_AssetInput = {
+ labels: array<Scalars.UUIDScalar.t>,
mileage?: int,
comment?: string,
color?: string,
hasRegTax: bool,
hasVat: bool,
assetNo?: int,
firstRegDate?: Scalars.LocalDateScalar.t,
regNo?: string,
makeModel?: string,
vin?: string,
}with
module UUIDScalar = {
type t = UUID.t
let parse = json =>
switch UUID.decode(json) {
| Some(uuid) => uuid
| None =>
Js.Console.error(`uuid decoding failure`)
Js.Exn.raiseError(`faild to parse uuid`)
}
let serialize = x => UUID.stringify(x)->Js.Json.string
}
module LocalDateScalar = {
type t = LocalDate.t
let parse = y => {
switch Js.Json.decodeString(y) {
| None => raise(InvalidScalarType(y, "type is not string"))
| Some(x) =>
switch LocalDate.parseIso8601(x) {
| None =>
raise(
InvalidScalarType(y, `failed to parse local date, value ${x} is not valid iso8601 date`),
)
| Some(x) => x
}
}
}
let serialize = x =>
LocalDate.toIso8601(x)->StringScalar.serialize
}Adding the array of scalars broke encoding.
Before:
{
"input": {
"assetNo": 10240,
"color": "Sort",
"comment": "The quick brow fox\n\njumps over the\n\nlazy\ndog",
"firstRegDate": "2013-04-09",
"hasRegTax": false,
"hasVat": true,
"makeModel": "RENAULT Ny Clio dCi 90 5d!",
"mileage": 44,
"regNo": "AE13324",
"vin": "VF15RRL0H48604439"
}
}After:
{
"input": {
"assetNo": 10240,
"color": "Sort",
"comment": "The quick brow fox\n\njumps over the\n\nlazy\ndog",
"firstRegDate": {
"day": 9,
"month": 4,
"year": 2013
},
"hasRegTax": false,
"hasVat": true,
"labels": [],
"makeModel": "RENAULT Ny Clio dCi 90 5d!",
"mileage": 44,
"regNo": "AE13324",
"vin": "VF15RRL0H48604439"
}
}It might be related to #407
Metadata
Metadata
Assignees
Labels
No labels