Adding and Implementing Zod

Aperta
#2 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
tooling

Direzione di ricerca

Inizia dalle funzioni di coordinamento e dal punto di ingresso convert, quindi esamina le funzioni di trasformazione esistenti e la documentazione dell’API. Definisci il comportamento di validazione di Zod, i tipi di trasformazione derivati e la struttura del report di conversione prima di implementarli. Il lavoro è completato quando vengono testati gli input malformati e gli output non validi, le discrepanze tra trasformazioni generano un errore in fase di compilazione e il comportamento del report è documentato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

  • Add Zod schemas for codemeta and code.json

    • Define Zod schemas that describe valid input for each format. Use them to parse and validate input inside the coordinator functions before the engine runs.
    • Acceptance: Malformed input produces a Zod validation error with a readable message identifying the offending field, rather than silently producing garbage output.
  • Validate converted output against the target schema

    • After convert returns, validate the result against the target format's Zod schema. Decide whether invalid output throws or returns a warnings array, and document the choice.
    • Acceptance: A transform that returns an incorrectly shaped value is caught by output validation in a test, and the behavior (throw vs warn) is documented in the API docs.
  • Type the transform functions properly

    • Replace (value: unknown) => unknown signatures with types derived from the Zod schemas, so transforms declare what they accept and return.
    • Acceptance: A transform with a mismatched input or output type produces a compile-time TypeScript error, and all existing transforms have typed signatures.
  • Emit a conversion report alongside converted output

    • Produce a structured report describing which source fields were ignored, which target fields were filled with defaults, and any lossy transforms that ran. The report can be opt-in or always returned.
    • Acceptance: Callers can obtain a report for any conversion, and at least one test asserts on report contents for a known-lossy input (e.g. multi-author codemeta → code.json).
Lingua principale
TypeScript
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DSACMS/codejson-crosswalk

Tutte le issue di DSACMS/codejson-crosswalk

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.