Builds on #10. This issue assumes the models are realigned to the official schema and covers only what #10 does not: enforcing invariants at input boundaries, and the test coverage to keep them enforced.
Is your feature request related to a problem?
Invalid input is not rejected at the boundary where it enters the SDK. It either travels to the API and fails there, or — worse — degrades silently. With the official schema as the baseline:
Proposed Solution / Feature
evaluate() / evaluateAsync(): throw JevValidationException on a null state, an empty primitives list, or duplicate primitive names. One check at the entry point guards both the native and gateway transports.
Choice: reject an empty criteria map and blank option names in the compact constructor.
- Tests for every invariant above, plus the existing ones (
Score level bounds, Noul/Choice/Score name validation, builder API-key check) — currently only two tests exist outside the gateway suite.
Example API Usage
jev.evaluate(null, questions); // -> JevValidationException (no state)
jev.evaluate("state", List.of()); // -> JevValidationException (no questions)
jev.evaluate("state", List.of(
new Noul("a", "?"), new Choice("a", "?", ...))); // -> JevValidationException (duplicate name "a")
Additional Context
Happy to implement together with the tests once #10 lands.
Is your feature request related to a problem?
Invalid input is not rejected at the boundary where it enters the SDK. It either travels to the API and fails there, or — worse — degrades silently. With the official schema as the baseline:
evaluate()/evaluateAsync()accept an empty question list or anullstate and send the request anyway.questionsmap), so two primitives sharing anamesilently collapse into one — no error, one answer just disappears.Choice.criteriais a map of option name → description. Blank option names and an empty map should be rejected at construction, likeScorealready rejects invalid levels (feat: Support Vercel AI Gateway as an alternative transport #7) andChoicealready caps options at 255.Proposed Solution / Feature
evaluate()/evaluateAsync(): throwJevValidationExceptionon anullstate, an empty primitives list, or duplicate primitive names. One check at the entry point guards both the native and gateway transports.Choice: reject an empty criteria map and blank option names in the compact constructor.Scorelevel bounds,Noul/Choice/Scorename validation, builder API-key check) — currently only two tests exist outside the gateway suite.Example API Usage
Additional Context
Happy to implement together with the tests once #10 lands.