{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-firebase/json-schema/google-firebase-test-ruleset-response-schema.json",
  "title": "TestRulesetResponse",
  "description": "The response for FirebaseRulesService.TestRuleset.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-firebase-firebaserules-projects-api-openapi.yml#/components/schemas/TestRulesetResponse",
  "type": "object",
  "properties": {
    "testResults": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/TestResult"
      },
      "description": "The set of test results given the test cases in the `TestSuite`. The results will appear in the same order as the test cases appear in the `TestSuite`."
    },
    "issues": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Issue"
      },
      "description": "Syntactic and semantic `Source` issues of varying severity. Issues of `ERROR` severity will prevent tests from executing."
    }
  },
  "$defs": {
    "ExpressionReport": {
      "properties": {
        "children": {
          "description": "Subexpressions",
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExpressionReport"
          }
        },
        "sourcePosition": {
          "$ref": "#/$defs/SourcePosition",
          "description": "Position of expression in original rules source."
        },
        "values": {
          "description": "Values that this expression evaluated to when encountered.",
          "items": {
            "$ref": "#/$defs/ValueCount"
          },
          "type": "array"
        }
      },
      "type": "object",
      "description": "Describes where in a file an expression is found and what it was evaluated to over the course of its use."
    },
    "FunctionCall": {
      "type": "object",
      "description": "Represents a service-defined function call that was invoked during test execution.",
      "properties": {
        "args": {
          "description": "The arguments that were provided to the function.",
          "items": {},
          "type": "array"
        },
        "function": {
          "description": "Name of the function invoked.",
          "type": "string"
        }
      }
    },
    "Issue": {
      "properties": {
        "severity": {
          "description": "The severity of the issue.",
          "type": "string",
          "enum": [
            "SEVERITY_UNSPECIFIED",
            "DEPRECATION",
            "WARNING",
            "ERROR"
          ]
        },
        "sourcePosition": {
          "$ref": "#/$defs/SourcePosition",
          "description": "Position of the issue in the `Source`."
        },
        "description": {
          "description": "Short error description.",
          "type": "string"
        }
      },
      "description": "Issues include warnings, errors, and deprecation notices.",
      "type": "object"
    },
    "SourcePosition": {
      "description": "Position in the `Source` content including its line, column number, and an index of the `File` in the `Source` message. Used for debug purposes.",
      "properties": {
        "fileName": {
          "type": "string",
          "description": "Name of the `File`."
        },
        "column": {
          "description": "First column on the source line associated with the source fragment.",
          "type": "integer",
          "format": "int32"
        },
        "currentOffset": {
          "description": "Start position relative to the beginning of the file.",
          "type": "integer",
          "format": "int32"
        },
        "endOffset": {
          "description": "End position relative to the beginning of the file.",
          "type": "integer",
          "format": "int32"
        },
        "line": {
          "description": "Line number of the source fragment. 1-based.",
          "format": "int32",
          "type": "integer"
        }
      },
      "type": "object"
    },
    "TestResult": {
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "STATE_UNSPECIFIED",
            "SUCCESS",
            "FAILURE"
          ],
          "description": "State of the test."
        },
        "expressionReports": {
          "type": "array",
          "description": "The mapping from expression in the ruleset AST to the values they were evaluated to. Partially-nested to mirror AST structure. Note that this field is actually tracking expressions and not permission statements in contrast to the \"visited_expressions\" field above. Literal expressions are omitted.",
          "items": {
            "$ref": "#/$defs/ExpressionReport"
          }
        },
        "debugMessages": {
          "type": "array",
          "description": "Debug messages related to test execution issues encountered during evaluation. Debug messages may be related to too many or too few invocations of function mocks or to runtime errors that occur during evaluation. For example: ```Unable to read variable [name: \"resource\"]```",
          "items": {
            "type": "string"
          }
        },
        "visitedExpressions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/VisitedExpression"
          },
          "description": "The set of visited permission expressions for a given test. This returns the positions and evaluation results of all visited permission expressions which were relevant to the test case, e.g. ``` match /path { allow read if: } ``` For a detailed report of the intermediate evaluation states, see the `expression_reports` field"
        },
        "functionCalls": {
          "description": "The set of function calls made to service-defined methods. Function calls are included in the order in which they are encountered during evaluation, are provided for both mocked and unmocked functions, and included on the response regardless of the test `state`.",
          "items": {
            "$ref": "#/$defs/FunctionCall"
          },
          "type": "array"
        },
        "errorPosition": {
          "$ref": "#/$defs/SourcePosition",
          "description": "Position in the `Source` or `Ruleset` where the principle runtime error occurs. Evaluation of an expression may result in an error. Rules are deny by default, so a `DENY` expectation when an error is generated is valid. When there is a `DENY` with an error, the `SourcePosition` is returned. E.g. `error_position { line: 19 column: 37 }`"
        }
      },
      "description": "Test result message containing the state of the test as well as a description and source position for test failures.",
      "type": "object"
    },
    "ValueCount": {
      "properties": {
        "value": {
          "description": "The return value of the expression"
        },
        "count": {
          "format": "int32",
          "type": "integer",
          "description": "The amount of times that expression returned."
        }
      },
      "type": "object",
      "description": "Tuple for how many times an Expression was evaluated to a particular ExpressionValue."
    },
    "VisitedExpression": {
      "properties": {
        "sourcePosition": {
          "$ref": "#/$defs/SourcePosition",
          "description": "Position in the `Source` or `Ruleset` where an expression was visited."
        },
        "value": {
          "description": "The evaluated value for the visited expression, e.g. true/false"
        }
      },
      "description": "Store the position and access outcome for an expression visited in rules.",
      "type": "object"
    }
  }
}