AttributeOptions has historically been an OptionSet for convenience and to avoid redundancy: https://github.com/mapbox/mapbox-directions-swift/pull/118#discussion_r109551839. However, after we made it an OptionSet, it became apparent that the Directions API could arbitrarily begin accepting or returning new unrecognized values.
OptionSet is essentially syntactic sugar and a more compact representation of Set composed with an enumeration. We should replace it with an explicit Set and an “extensible enumeration”. This could take the form of either a struct with constants or an enumeration with an unrecognized(_:) case (taking the raw string as an associated value). A less compact representation in memory won’t be a problem, because it’s unlikely that a request would ever specify more than a handful of attributes anyways.
AttributeOptions has historically been an OptionSet for convenience and to avoid redundancy: https://github.com/mapbox/mapbox-directions-swift/pull/118#discussion_r109551839. However, after we made it an OptionSet, it became apparent that the Directions API could arbitrarily begin accepting or returning new unrecognized values.
OptionSet is essentially syntactic sugar and a more compact representation of Set composed with an enumeration. We should replace it with an explicit Set and an “extensible enumeration”. This could take the form of either a struct with constants or an enumeration with an
unrecognized(_:)
case (taking the raw string as an associated value). A less compact representation in memory won’t be a problem, because it’s unlikely that a request would ever specify more than a handful of attributes anyways.This would be a backwards-incompatible change.