Class TransactionCorrelator

java.lang.Object
com.shaft.capture.generate.api.TransactionCorrelator

public final class TransactionCorrelator extends Object
Finds VOLATILE response leaves that a later transaction's request reuses (the common create -> read/update case: a generated ID from a POST response reappears in a later GET's URL, or a later PATCH's request body), and upgrades them to LeafClassification.CORRELATED so codegen chains them through a variable (e.g. String createdOrderId = api.getResponseJSONValue("$.id");) instead of asserting or replaying a literal. Unmatched VOLATILE leaves are left as-is; codegen falls back to the recorded literal for those.
  • Method Details

    • correlate

      public static List<CorrelatedTransaction> correlate(List<ApiTransaction> transactions)
      Correlates volatile response values across transactions, in encounter (chronological) order. Only later transactions (by list index, matching recording order) are searched, matching how a value can only be reused after it was first observed.
      Parameters:
      transactions - transactions in recorded order
      Returns:
      one CorrelatedTransaction per input transaction, in the same order