Rules around remixing field valueTypes

#1

What rules regulate the remix of fields? Specifically, can I remix a primitive field to be a reference OR included type field?

I was trying to do this:
entity type WorkOrder schema name “WO” {
status : string enum (‘open’, ‘closed’, ‘in progress’)
}
remix type WorkOrder {
status : WorkStatus
}

When I got this Provisioning Error:
TypeCheckException: Invalid value “Obj [,id=Completed]” for field status in type WorkOrder. Can only be one of [open, closed, in progress].

0 Likes

#2

From JC:
I believe the intention is that you can only narrow the values in a field. (Changing the fundamental type is problematic because which type you fetched, you’d get a very different value for that field.)

0 Likes

#3

Makes sense. To be explicit, you’re suggesting a remixed field:

  1. has to maintain the value type (reference, fkey, primitive, map, included, ???) of the inherited type
  2. specifically in the case of a enum field, can only be a subset of the values of the inherited type
0 Likes

#4

I believe that in the case of the enum field you can actually EXPAND the options. However in this case you have changed the value type from “string” to WorkStatus which is an invalid value type override.

This would be supported:

remix type WorkOrder {
status : string enum (‘open’, ‘closed’, ‘in progress’, ‘completed’)
}

0 Likes