Bixby Developer Center

References

role-of

optionalmultiple allowedvalue required

There are cases where you want to assign a specific role to a feature, but not extend the feature.

Suppose you have a FindFlight action that takes a DepartureAirport and ArrivalAirport. If these types are extensions, any actions above in the plan needs to know about the downstream type expected and have to instantiate the subtype. However, with a role assignment, an Airport that is instantiated upstream in the plan can be converted into a specific role when needed.

The difference between an extension and role assignment is subtle, but important. With extends you can define new properties specific to the child concept. With role-of, you cannot assign new properties.

For more information, see the Role Assignment section of the Modeling Concepts Developers' Guide.

Example

structure (DepartureAirport) {
role-of (Airport)
}
Note

If a concept has a role-of an enum, it must also be an enum, and cannot add new symbols to the enum. If you extend the enum, however, the child concept can add new symbols to it.