Skip to content

Change jsonKeyEncodingStrategy and jsonKeyDecodingStrategy to non-optional with default values #108

@brendanlensink

Description

@brendanlensink

As they currently exist, you can create a request like

struct UserRequest: Request {
    // ...

    var jsonKeyDecodingStrategy: JSONDecoder.KeyDecodingStrategy { return .convertFromSnakeCase }
}

that looks correct but won't work, since it should be JSONDecoder.KeyDecodingStrategy?.

To fix this, and make it more difficult to mess up, I think we should switch both encoding strategy params to non-optional and just provide a default setting, like we do with smartUnwrapKey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions