[schema] DaySentence: The sentence-opened event, an id and never text

This commit is contained in:
2026-11-02 08:55:04 +01:00
parent 9c7f67a1f0
commit ad41c58730
3 changed files with 63 additions and 2 deletions
+3 -1
View File
@@ -10,8 +10,9 @@
import { Ajv, type ErrorObject, type ValidateFunction } from 'ajv';
import careEvent from '../schemas/care-event.schema.json' with { type: 'json' };
import hopeSentence from '../schemas/hope-sentence.schema.json' with { type: 'json' };
import sentenceOpened from '../schemas/sentence-opened.schema.json' with { type: 'json' };
import trace from '../schemas/trace.schema.json' with { type: 'json' };
import type { CareEvent, HopeSentence, Trace } from './generated/index.js';
import type { CareEvent, HopeSentence, SentenceOpened, Trace } from './generated/index.js';
export type SchemaResult<T> =
| { readonly ok: true; readonly value: T }
@@ -38,4 +39,5 @@ function describe(error: ErrorObject): string {
export const validateHopeSentence = wrap<HopeSentence>(ajv.compile(hopeSentence));
export const validateCareEvent = wrap<CareEvent>(ajv.compile(careEvent));
export const validateSentenceOpened = wrap<SentenceOpened>(ajv.compile(sentenceOpened));
export const validateTrace = wrap<Trace>(ajv.compile(trace));