-
Notifications
You must be signed in to change notification settings - Fork 404
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The following task:
export const query10 = query({
args: {
i: v.literal(1),
},
returns: {
i: v.literal(1),
},
handler: (ctx, args) => {
return args;
},
});
Will produce the following schema:
{
"args": {
"type": "object",
"value": {
"i": {
"fieldType": {
"type": "literal",
"value": 1
},
"optional": false
}
}
},
"functionType": "Query",
"identifier": "tasks.js:query10",
"returns": {
"type": "object",
"value": {
"i": {
"fieldType": {
"type": "literal",
"value": 1
},
"optional": false
}
}
},
"visibility": {
"kind": "public"
}
}
However this is incorrect.
The literal type should be 1.0
.
This results in a crash at runtime:
ClientError.serverError(msg: [Request ID: 67be452c7b31cf99] Server Error
ArgumentValidationError: `1` does not match literal validator `v.literal(1.0)`.Path: .i
)
It's not enough just to copy the contents of the literal to the function-spec, we should really have another field called literalType
for this.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working