{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grepr/json-schema/grepr-create-issue-request-schema.json",
  "title": "CreateIssueRequest",
  "description": "Files a new issue. Creating never deduplicates: search first, and update or record an occurrence on an existing issue instead of filing a second one. The reporter, number and timestamps come from the caller and the server, never from the request.",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grepr-openapi.json#/components/schemas/CreateIssueRequest",
  "properties": {
    "confidence": {
      "description": "How sure the reporter is that the problem is real.",
      "enum": [
        "CONFIRMED",
        "LIKELY",
        "UNVERIFIED"
      ],
      "type": "string"
    },
    "description": {
      "description": "The current understanding, in markdown, or null for none.",
      "maxLength": 32768,
      "minLength": 0,
      "type": "string"
    },
    "entities": {
      "additionalProperties": {
        "description": "The `entity:*` tags it concerns; an unprefixed key is put in the `entity:` namespace. Keys are stored in lower case, and values as given; searches match both in any case.",
        "type": "string"
      },
      "description": "The `entity:*` tags it concerns; an unprefixed key is put in the `entity:` namespace. Keys are stored in lower case, and values as given; searches match both in any case.",
      "type": "object"
    },
    "evidence": {
      "description": "Things a person can open to check the claim.",
      "items": {
        "$ref": "#/$defs/IssueEvidence"
      },
      "maxItems": 50,
      "minItems": 0,
      "type": "array"
    },
    "expiresAt": {
      "description": "When the issue stops applying.",
      "format": "date-time",
      "type": "string"
    },
    "fingerprint": {
      "description": "An optional free-form key for exact-match search.",
      "maxLength": 256,
      "minLength": 0,
      "type": "string"
    },
    "labels": {
      "description": "Categories; reuse the labels search reports as in use.",
      "items": {
        "description": "Categories; reuse the labels search reports as in use.",
        "type": "string"
      },
      "maxItems": 20,
      "minItems": 0,
      "type": "array"
    },
    "links": {
      "description": "Related pipelines, investigations, memories, suggestions and external tickets.",
      "items": {
        "$ref": "#/$defs/IssueLink"
      },
      "maxItems": 50,
      "minItems": 0,
      "type": "array"
    },
    "nextStep": {
      "description": "The concrete next action and who it waits on.",
      "maxLength": 4096,
      "minLength": 0,
      "type": "string"
    },
    "priority": {
      "description": "How soon someone should act; agents must set it. A person who leaves it null files at `P2`, unlocked, so triage can set it.",
      "enum": [
        "P0",
        "P1",
        "P2",
        "P3"
      ],
      "type": "string"
    },
    "revisitAt": {
      "description": "When someone should check back.",
      "format": "date-time",
      "type": "string"
    },
    "state": {
      "description": "The open state to file it in; null files it in `TRIAGE`. Agents may file only in `TRIAGE`, or `READY` when their handoff mode allows it.",
      "enum": [
        "TRIAGE",
        "READY",
        "IN_PROGRESS",
        "WAITING",
        "MONITORING",
        "CLOSED"
      ],
      "type": "string"
    },
    "teamIds": {
      "description": "The teams that may see it; people only, from the teams they can edit issues of (any for an organization-wide person). Absent: a team-scoped person's own teams, and none for an organization-wide person, which keeps the issue to organization-wide users.",
      "items": {
        "description": "The teams that may see it; people only, from the teams they can edit issues of (any for an organization-wide person). Absent: a team-scoped person's own teams, and none for an organization-wide person, which keeps the issue to organization-wide users.",
        "type": "string"
      },
      "maxItems": 50,
      "minItems": 0,
      "type": "array"
    },
    "title": {
      "description": "One line naming the problem, not the symptom's timestamp.",
      "maxLength": 200,
      "minLength": 0,
      "type": "string"
    }
  },
  "required": [
    "confidence",
    "title"
  ],
  "type": "object",
  "$defs": {
    "IssueEvidence": {
      "description": "Something a person can open to check an issue's claim.",
      "properties": {
        "from": {
          "description": "Start of a log query's time range, or null.",
          "format": "date-time",
          "type": "string"
        },
        "kind": {
          "description": "What the evidence points at.",
          "enum": [
            "LOG_QUERY",
            "EVENT",
            "URL"
          ],
          "type": "string"
        },
        "label": {
          "description": "A short description of what it shows, or null.",
          "maxLength": 200,
          "minLength": 0,
          "type": "string"
        },
        "target": {
          "description": "The Grepr log query for LOG_QUERY, the event id for EVENT, or an http(s) URL for URL.",
          "maxLength": 4096,
          "minLength": 0,
          "type": "string"
        },
        "to": {
          "description": "End of a log query's time range, or null.",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "target"
      ],
      "type": "object"
    },
    "IssueLink": {
      "description": "A typed reference from an issue to something related. A link grants nothing: the linked page applies its own access checks. A link to an issue the reader can't see comes back with only its kind and `hidden`, so an issue reveals nothing about another team's.",
      "properties": {
        "hidden": {
          "description": "True for a link to an issue the reader can't see. Set only in responses.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "kind": {
          "description": "What the link points at.",
          "enum": [
            "PIPELINE",
            "INVESTIGATION",
            "MEMORY",
            "AGENT_SUGGESTION",
            "EXTERNAL",
            "ISSUE"
          ],
          "type": "string"
        },
        "label": {
          "description": "A short description, or null.",
          "maxLength": 200,
          "minLength": 0,
          "type": "string"
        },
        "target": {
          "description": "Null only for a hidden issue link in a response.",
          "maxLength": 4096,
          "minLength": 0,
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "kind"
      ],
      "type": "object"
    }
  }
}