Skip to content

Makes Identifier RawRepresentable (explicitely)#6

Open
s4cha wants to merge 1 commit intoJohnSundell:masterfrom
s4cha:master
Open

Makes Identifier RawRepresentable (explicitely)#6
s4cha wants to merge 1 commit intoJohnSundell:masterfrom
s4cha:master

Conversation

@s4cha
Copy link

@s4cha s4cha commented Jun 10, 2020

From what I can see, Identifier is already complying to the RawRepresentable protocol implicitly:
It has public let rawValue + public init(rawValue: Value.RawIdentifier).

This just adds this compliance explicitly.

For my use case this fixes the JSON parsing (using Arrow)

extension YPBreed: ArrowParsable {
    public mutating func deserialize(_ json: JSON) {
        let resource = resourceKeyFrom(json)
        id <-- resource["id"]
        [...]
    }
}

Prior, the parsing wouldn't work since it relies on RawRepresentable 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant