Skip to content

Expose object's schema shape #66

@darkowic

Description

@darkowic

Consider following schema

const mySchema = object({
  id: string(),
  name: pipe(string, minStringLength(10))
})

Now, I would like to create another schema to validate only part of mySchema. For that reason I can create another schema and pick only a few validators from mySchema, potentially like this:

const anotherSchema = object({
  name: mySchema.name
})

But the object's validator shape is not available after the validator is built. I took a look at the code and this is potentially possible but the types in refine function are too complex for me at the moment :)

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