Text or structured state
Input does not have to be JSON. A string is valid and is wrapped as text automatically:JsonContent when field names add useful context:
JsonContent::text(), object(), list(), from(), and fromJson() preserve the root kind. The same value type is accepted for question instructions, option descriptions, criteria descriptions, and Score levels.
Noul: probability of yes
UseNoul for a binary proposition. Its answer is one probability in [0, 1]: the probability that the proposition is true.
1 supports yes, a result near 0 supports no, and a result near 0.5 is uncertain. Noul intentionally has no separate confidence field: the probability is the result.
Choice: winner from a closed set
UseChoice when exactly one application-owned option should win. Option IDs are strings and remain strings even when they look numeric.
other, unknown, or not_applicable option when the named choices are not exhaustive. Choice requires at least one option, and option IDs must be unique.
Dynamic options are ordinary typed values, so they can be built from current application state:
Score: position across ordered levels
UseScore when the application needs an ordered judgment. Levels are indexed from 0 in the order supplied and must contain at least two entries.
1.4 lies between the second and third supplied levels; it is not an arbitrary rating on a hidden scale. Make adjacent levels concrete, distinct, and independently understandable.
Group questions over shared state
UseQuestions::of() to evaluate several independent judgments over the same state in one request:
DecisionRequest requires at least one question. Use Questions::question($id) to inspect a definition and all(), count(), or toArray() when building tooling around a collection.
Do not make one question depend on another answer inside the same request. Execute a second Decision when a later judgment genuinely depends on the first result.
Portable question payloads
Every question and collection supportstoArray(). Questions::fromArray() reconstructs the discriminated noul, choice, and score variants:
InvalidArgumentException instead of being forwarded as ambiguous provider input.