Skip to content

feat: Harden input validation across models and expand test coverage #9

Description

@yukik8

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions