Skip to content

Add schema validation to Cursorless api boundary #983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks
pokey opened this issue Sep 29, 2022 · 0 comments
Open
4 tasks

Add schema validation to Cursorless api boundary #983

pokey opened this issue Sep 29, 2022 · 0 comments
Labels
code quality Improvements to code quality

Comments

@pokey
Copy link
Member

pokey commented Sep 29, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improvements to code quality
Projects
None yet
Development

No branches or pull requests

1 participant