Class FakeScriptParser

java.lang.Object
com.agentforge4j.llm.fake.FakeScriptParser

public final class FakeScriptParser extends Object
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 Details

    • SUPPORTED_SCHEMA_VERSION

      public static final int SUPPORTED_SCHEMA_VERSION
      The only schema version this parser accepts.
      See Also:
  • Constructor Details

    • FakeScriptParser

      public FakeScriptParser()
      Creates a parser with a private ObjectMapper.
    • 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 be null
  • Method Details

    • parse

      public FakeScript parse(String json)
      Parses and validates script JSON into an immutable FakeScript.
      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