feat(schema/input-schemas): define TaskInput, DependencyEdge schemas and Nullable re-export
- Add TaskInput schema with all fields per architecture (id, name, dependsOn, categorical fields as Optional(Nullable(...)), metadata fields) - Add DependencyEdge schema with from, to, qualityRetention fields - Re-export Nullable helper from task.ts for convenience - Add type aliases: TaskInput, DependencyEdge via Static<typeof> - Add 49 tests covering validation, nullable fields, edge cases, type correctness
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
id: schema/input-schemas
|
||||
name: Define TaskInput, DependencyEdge, and Nullable helper
|
||||
status: pending
|
||||
status: completed
|
||||
depends_on:
|
||||
- schema/enums
|
||||
scope: narrow
|
||||
@@ -16,14 +16,14 @@ Define the `TaskInput` and `DependencyEdge` input schemas in `src/schema/task.ts
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] `src/schema/task.ts` exports `Nullable` helper: `const Nullable = <T extends TSchema>(T: T) => Type.Union([T, Type.Null()])`
|
||||
- [ ] `TaskInput` schema defined with all fields per [schemas.md](../../../docs/architecture/schemas.md):
|
||||
- [x] `src/schema/task.ts` exports `Nullable` helper: `const Nullable = <T extends TSchema>(T: T) => Type.Union([T, Type.Null()])` — Re-exported from enums.ts
|
||||
- [x] `TaskInput` schema defined with all fields per [schemas.md](../../../docs/architecture/schemas.md):
|
||||
- `id: Type.String()`, `name: Type.String()`, `dependsOn: Type.Array(Type.String())`
|
||||
- Categorical fields: `Type.Optional(Nullable(TaskXxxEnum))` for status, scope, risk, impact, level, priority
|
||||
- Metadata fields: `tags`, `assignee`, `due`, `created`, `modified`
|
||||
- [ ] `DependencyEdge` schema: `from: Type.String()`, `to: Type.String()`, `qualityRetention: Type.Optional(Type.Number({ default: 0.9 }))`
|
||||
- [ ] Type aliases derived: `type TaskInput = Static<typeof TaskInput>`, `type DependencyEdge = Static<typeof DependencyEdge>`
|
||||
- [ ] Re-exported from `src/schema/index.ts`
|
||||
- [x] `DependencyEdge` schema: `from: Type.String()`, `to: Type.String()`, `qualityRetention: Type.Optional(Type.Number({ default: 0.9 }))`
|
||||
- [x] Type aliases derived: `type TaskInput = Static<typeof TaskInput>`, `type DependencyEdge = Static<typeof DependencyEdge>`
|
||||
- [x] Re-exported from `src/schema/index.ts`
|
||||
|
||||
## References
|
||||
|
||||
@@ -32,8 +32,11 @@ Define the `TaskInput` and `DependencyEdge` input schemas in `src/schema/task.ts
|
||||
|
||||
## Notes
|
||||
|
||||
> To be filled by implementation agent
|
||||
`Nullable` was already defined in `src/schema/enums.ts` by the `schema/enums` task. It is re-exported from `src/schema/task.ts` for convenience, satisfying the acceptance criteria. All other schemas (`TaskInput`, `DependencyEdge`) are brand new.
|
||||
|
||||
## Summary
|
||||
|
||||
> To be filled on completion
|
||||
Implemented TaskInput and DependencyEdge input schemas in `src/schema/task.ts`, plus re-exported Nullable helper.
|
||||
- Modified: `src/schema/task.ts` (implemented TaskInput, DependencyEdge schemas with type aliases)
|
||||
- Modified: `test/schema.test.ts` (added 49 tests for TaskInput, DependencyEdge, Nullable re-export, type alias verification)
|
||||
- All 126 tests passing, lint clean.
|
||||
Reference in New Issue
Block a user