Bixby Developer Center

Guides

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.

Example

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