grantila/suretype

Is it possible to extend a schema?

escobar5 opened this issue · 1 comments

Say I have:

const paginatedListSchema = v.object({
  limit: v.number().integer().gt(0).default(10),
  skip: v.number().integer().gte(0).default(0),
});

And I want to have a schema that extends it?, something like:

const newSchema = v.extend(paginatedListSchema, v.object({
  query: v.string()
});

I think you want to use .additional

paginatedListSchema.additional({
  query: v.string()
})