Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes Identifier RawRepresentable (explicitely) #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
1 participant