java.lang.Object
com.agentforge4j.llm.fake.FakeScriptParser
Parses fake-provider script JSON into an immutable
FakeScript. Validates against the module-local
fake-llm-script.schema.json (networknt, JSON Schema draft 2020-12, the same dialect and pinned validator the
rest of the project uses), rejects duplicate keys, and rejects an unsupported schema version. Ordinal gaps are
allowed — a missing ordinal fails closed at the call that requests it, intentionally.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe only schema version this parser accepts. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a parser with a privateObjectMapper.FakeScriptParser(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates a parser using the given mapper for both script and schema parsing. -
Method Summary
-
Field Details
-
SUPPORTED_SCHEMA_VERSION
public static final int SUPPORTED_SCHEMA_VERSIONThe only schema version this parser accepts.- See Also:
-
-
Constructor Details
-
FakeScriptParser
public FakeScriptParser()Creates a parser with a privateObjectMapper. -
FakeScriptParser
public FakeScriptParser(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates a parser using the given mapper for both script and schema parsing.- Parameters:
objectMapper- JSON mapper; must not benull
-
-
Method Details
-
parse
Parses and validates script JSON into an immutableFakeScript.- Parameters:
json- the script JSON text; must not be blank- Returns:
- the parsed, immutable script
- Throws:
IllegalArgumentException- if the JSON is malformed, fails schema validation, declares an unsupported schema version, or contains duplicate keys
-