cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Add schema validation to Cursorless api boundary

Open pokey opened this issue 3 years ago • 0 comments

For all places where the Cursorless extension ingests data from the outside world, we should validate against a schema. Here are a few such places:

  • [ ] Cursorless command arguments (both primary cursorless.command action and others, eg experimental keyboard)
  • [ ] Custom snippets (and built-in snippets)
  • [ ] Settings
  • [ ] other places?

We'd like to define these schemas using zod. This library will automatically allow Typescript to infer types. We can start by using ts-to-zod to generate initial schema

For custom snippets and settings, we can look into automatically generating json schema using zod-to-json-schema so that we have a single source of truth

pokey avatar Sep 29 '22 11:09 pokey