oscklmO
Convex Community3y ago
12 replies
oscklm

entering the literals of a v.union() when using run function in dashboard

When running functions through the dashboard, i can't seem to figure out how to manually type the value of a v.union(v.literal("easy"), v.literal("medium"), v.literal("hard")) when i enter the value i just want as a string "hard" i get an error.


The function i try to run via the dashboard (the type field is a v.union aswell as the difficulty)
{
  activityValues: {
    details: {
      description: "Bevæg dig udenfor og find 20 fugle og tag et billede og upload dit fund",
      difficulty: "hard",
      rewardPoints: 200,
      thumbnail: "",
      title: "Find 20 fugle i naturen",
    },
    type: "challenge",
  },
  videoId: "rx7frx81vdxvnx7g1h2wz1t4w16h18y8",
}


failure
ArgumentValidationError: Value does not match validator.
Path: .activityValues
Value: {details: {description: "Bevæg dig udenfor og find 20 fugle og tag et billede og upload dit fund", difficulty: "hard", rewardPoints: 200.0, thumbnail: "", title: "Find 20 fugle i naturen"}, type: "challenge"}
Validator: v.union(v.object({details: v.object({description: v.optional(v.string()), difficulty: v.union(v.literal("easy"), v.literal("medium"), v.literal("hard")), rewardPoints: v.float64(), thumbnail: v.optional(v.id("_storage")), title: v.string()}), 
... rest of the error, too long to paste
Was this page helpful?