Skip to content
This repository was archived by the owner on Dec 19, 2022. It is now read-only.
This repository was archived by the owner on Dec 19, 2022. It is now read-only.

Strummer v3 proposal #191

Description

@nguyenchr

I have a few changes that I would like to introduce into strummer that will require a major release

  1. match() will return an object { errors: [] }
    • currently is just returns an array of errors
    • by returning an object instead we can then start to return additional things for example with s.integer({ parse: true }) it would be great to return the parsedValue so we are not having to repeat the parsing in our code outside of strummer
  2. s.object will be a strict matcher (basically what s.objectWithOnly is now)
    • s.object currently allow extra fields that are not defined in the schema, so essentially it is acting as a partial object matcher
    • by default I think it would be good to be strict, and if you just want partial matching we can introduce a new s.partial matcher for that purpose, it is more explicit this way
  3. change the params of s.object (and s.partial when it's introduced)
    • right now s.object has a single argument which is the schema itself, the problem with this is that you can't pass in the standard arguments e.g. { optional: true }
    • something like this should be possible s.object({ optional: true, schema: { foo: s.string(), bar: s.number() } })

Activity

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

Metadata

Metadata

Assignees

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