Change spelling of "direct" subscript overload on Entity.
Pre-release
Pre-release
Take the following definitions:
enum TestDescription: EntityDescription {
static var jsonType: String { return "test" }
typealias Relationships = NoRelationships
struct Attributes: JSONAPI.Attributes {
let normal: Attribute<String>
var direct: String { return normal.value }
}
}
typealias Test = Entity<TestDescription, NoMetadata, NoLinks, String>
let test: Test = ...You used to be able to access both attributes using the default subscript:
let one: String = test[\.normal]
let two = test[\.direct]However, in the case of test[\.normal], the code was ambiguous unless you explicitly asked for a String (the compiler would not know if you wanted the String or the whole Attribute<String>).
That is what has changed. There is no more ambiguity, but now the direct access subscript has a new spelling:
let one = test[\.normal]
let two = test[direct: \.direct]It may seem like the verbosity of the code has just moved from one place to another, but the much less common feature (direct access) has taken on the burden.