Skip to content

Coerce options #5

@jdesrosiers

Description

@jdesrosiers

I'm having an issue with the coerce functionality. The way I see it, this function does three things: type conversion, filling in defaults, and filling in required properties. When I use the coerce function, I sometimes want type conversion, I always want defaults, and I never want filling in required properties. One way to deal with this would be to add an options parameter the coerce function. This would allow the user to fine tune the coerce features that are applied. Another approach would be to factor each of the coercion features out in separate public functions. Developers could then use those functions to coerce their data how they want before passing it to the validate function. The coerce function would use these functions internally. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions