How to pass in type information for seed data?

#1

I have the below type:

@seed(userUpdatable=true, userRemovable=false, userCreatable=true)
entity type myConfig  mixes SeedData {
  ...
  myField: anyof(A, B)
  ...
}

When I create seed data for this type, how do I pass in the type information?

{
  ...
  "myField" : {"id": "myId"}       <---- I tried  {"id": "myId", "type" : "A"}, returns provision error
  ...
}

Below is the provision error, if it helps

Error(s) while handling package JSON/CSV data. … , reason=c3.love.exceptions.C3RuntimeException: Expecting specific type for fields with ‘any’, ‘anyof’ or ‘Obj’ type at JSON document at 11:13, message: Expecting specific type for fields with ‘any’, ‘anyof’ or ‘Obj’ type at JSON document at 11:13\n"}

0 Likes

#2

the “type” field needs to be the first in the json

{"type" : "A","id": "myId"}

0 Likes