Migration to Zod
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 413
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 21
Description
We need to migrate the codebase to zod. This epic issue is for creating issues that have to do with this migration.
Introduction
As CLI team, we're doing a major refactoring of the code base on how we validate incoming options. In the new situation, we're now using Zod. The idea is that we define options as a Zod schema, and parse/validate the incoming options using that schema. This is a major change that needs to be done on every command in the CLI codebase and as such is a lot of work. But you can help 💪...
Implementation
There's some reference material for migrating to Zod. Check out:
entra administrativeunit <verb>commands.- The
logincommand - The
adaptivecard sendcommand
There's a couple of things that are important:
- Define an options object, based on
globalOptionsZod. - Implement the schema function in the command class to return the options object.
- Add any options to the schema if options are currently defined on the command
- Add refinements if necessary for additional validation.
- Remove the command class constructor and all its functions
- Update the test file with the schema and
safeParse()/parse()function calls.
Do check out our reference implementations to see what we mean here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reference implementations for entra administrativeunit <verb>, login, and adaptivecard send, then inspect the command classes and their test files. Compare their Zod schemas and safeParse() or parse() calls with commands still using the old validation approach. Done means the selected command defines its options from globalOptionsZod, includes needed refinements, and has updated tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100