{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-repo/json-schema/microsoft-azure-repo-git-pull-request-schema.json",
  "title": "GitPullRequest",
  "description": "Represents all the data associated with a pull request including status, branches, reviewers, merge state, and linked work items.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-repo-pull-requests-api-openapi.yml#/components/schemas/GitPullRequest",
  "type": "object",
  "properties": {
    "pullRequestId": {
      "type": "integer",
      "format": "int32",
      "description": "Unique ID of the pull request"
    },
    "codeReviewId": {
      "type": "integer",
      "format": "int32",
      "description": "Code review ID used internally"
    },
    "status": {
      "type": "string",
      "enum": [
        "notSet",
        "active",
        "abandoned",
        "completed",
        "all"
      ],
      "description": "Current status of the pull request"
    },
    "title": {
      "type": "string",
      "description": "Title of the pull request"
    },
    "description": {
      "type": "string",
      "description": "Description of the pull request"
    },
    "sourceRefName": {
      "type": "string",
      "description": "Name of the source branch (e.g., refs/heads/feature-branch)"
    },
    "targetRefName": {
      "type": "string",
      "description": "Name of the target branch (e.g., refs/heads/main)"
    },
    "createdBy": {
      "$ref": "#/$defs/IdentityRef"
    },
    "creationDate": {
      "type": "string",
      "format": "date-time",
      "description": "Date the pull request was created"
    },
    "closedDate": {
      "type": "string",
      "format": "date-time",
      "description": "Date the pull request was closed"
    },
    "closedBy": {
      "$ref": "#/$defs/IdentityRef"
    },
    "isDraft": {
      "type": "boolean",
      "description": "Whether this is a draft pull request"
    },
    "mergeStatus": {
      "type": "string",
      "enum": [
        "notSet",
        "queued",
        "conflicts",
        "succeeded",
        "rejectedByPolicy",
        "failure"
      ],
      "description": "Current merge status"
    },
    "mergeId": {
      "type": "string",
      "format": "uuid",
      "description": "ID of the merge job"
    },
    "mergeFailureMessage": {
      "type": "string",
      "description": "Message describing merge failure if applicable"
    },
    "mergeFailureType": {
      "type": "string",
      "enum": [
        "none",
        "unknown",
        "caseSensitive",
        "objectTooLarge"
      ],
      "description": "Type of merge failure"
    },
    "lastMergeSourceCommit": {
      "$ref": "#/$defs/GitCommitRef"
    },
    "lastMergeTargetCommit": {
      "$ref": "#/$defs/GitCommitRef"
    },
    "lastMergeCommit": {
      "$ref": "#/$defs/GitCommitRef"
    },
    "reviewers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/IdentityRefWithVote"
      },
      "description": "List of reviewers with their vote status"
    },
    "repository": {
      "$ref": "#/$defs/GitRepository"
    },
    "commits": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/GitCommitRef"
      },
      "description": "Commits included in the pull request"
    },
    "completionOptions": {
      "$ref": "#/$defs/GitPullRequestCompletionOptions"
    },
    "completionQueueTime": {
      "type": "string",
      "format": "date-time",
      "description": "Time the PR entered the completion queue"
    },
    "autoCompleteSetBy": {
      "$ref": "#/$defs/IdentityRef"
    },
    "supportsIterations": {
      "type": "boolean",
      "description": "Whether the PR supports multiple iterations"
    },
    "forkSource": {
      "$ref": "#/$defs/GitRepositoryRef"
    },
    "labels": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WebApiTagDefinition"
      },
      "description": "Labels associated with the pull request"
    },
    "workItemRefs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ResourceRef"
      },
      "description": "Linked work items"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "REST API URL for this pull request"
    },
    "artifactId": {
      "type": "string",
      "description": "Artifact ID in format vstfs:///Git/PullRequestId/{projectId}/{repoId}/{prId}"
    },
    "_links": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "$defs": {
    "GitChange": {
      "type": "object",
      "description": "Represents a change to an item in a commit",
      "properties": {
        "changeId": {
          "type": "integer",
          "format": "int32",
          "description": "ID of the change within the group"
        },
        "changeType": {
          "type": "string",
          "enum": [
            "add",
            "edit",
            "delete",
            "rename",
            "merge",
            "lock",
            "branch",
            "rollback",
            "none"
          ],
          "description": "Type of change made to the item"
        },
        "item": {
          "type": "object",
          "description": "The affected item",
          "properties": {
            "objectId": {
              "type": "string"
            },
            "originalObjectId": {
              "type": "string"
            },
            "gitObjectType": {
              "type": "string"
            },
            "commitId": {
              "type": "string"
            },
            "path": {
              "type": "string"
            },
            "url": {
              "type": "string"
            }
          }
        },
        "originalPath": {
          "type": "string",
          "description": "Original path if the item was renamed"
        },
        "url": {
          "type": "string",
          "description": "URL to retrieve the item"
        }
      }
    },
    "GitCommitRef": {
      "type": "object",
      "description": "Properties describing a Git commit and associated metadata including author, committer, message, and related resources.",
      "properties": {
        "commitId": {
          "type": "string",
          "description": "SHA-1 hash of the commit"
        },
        "author": {
          "$ref": "#/$defs/GitUserDate"
        },
        "committer": {
          "$ref": "#/$defs/GitUserDate"
        },
        "comment": {
          "type": "string",
          "description": "Commit message"
        },
        "commentTruncated": {
          "type": "boolean",
          "description": "Whether the comment was truncated"
        },
        "changeCounts": {
          "type": "object",
          "description": "Counts of change types in the commit",
          "additionalProperties": {
            "type": "integer"
          }
        },
        "changes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GitChange"
          },
          "description": "List of changes in the commit"
        },
        "parents": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "SHA-1 hashes of parent commits"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL for this commit"
        },
        "remoteUrl": {
          "type": "string",
          "format": "uri",
          "description": "Web URL to view the commit"
        },
        "statuses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GitStatus"
          },
          "description": "Status checks posted against this commit"
        },
        "workItems": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResourceRef"
          },
          "description": "Linked work items"
        },
        "push": {
          "type": "object",
          "description": "Push that included this commit",
          "properties": {
            "pushId": {
              "type": "integer",
              "format": "int32"
            },
            "date": {
              "type": "string",
              "format": "date-time"
            },
            "pushedBy": {
              "$ref": "#/$defs/IdentityRef"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      }
    },
    "GitPullRequestCompletionOptions": {
      "type": "object",
      "description": "Options that control how the pull request is completed and merged.",
      "properties": {
        "mergeCommitMessage": {
          "type": "string",
          "description": "Commit message for the merge commit"
        },
        "mergeStrategy": {
          "type": "string",
          "enum": [
            "noFastForward",
            "squash",
            "rebase",
            "rebaseMerge"
          ],
          "description": "Merge strategy to use. NoFastForward creates a merge commit, squash creates a single commit, rebase replays commits."
        },
        "deleteSourceBranch": {
          "type": "boolean",
          "description": "Delete the source branch after merge"
        },
        "bypassPolicy": {
          "type": "boolean",
          "description": "Bypass branch policies during completion"
        },
        "bypassReason": {
          "type": "string",
          "description": "Reason for bypassing policies"
        },
        "transitionWorkItems": {
          "type": "boolean",
          "description": "Transition linked work items to the next state on completion"
        },
        "squashMerge": {
          "type": "boolean",
          "description": "Deprecated. Use mergeStrategy instead."
        },
        "autoCompleteIgnoreConfigIds": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "int32"
          },
          "description": "Policy configuration IDs that auto-complete should not wait for"
        }
      }
    },
    "GitRepository": {
      "type": "object",
      "description": "Represents a Git repository in Azure DevOps, including its metadata, URLs, project reference, and configuration such as default branch.",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Unique identifier of the repository"
        },
        "name": {
          "type": "string",
          "description": "Name of the repository"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL for the repository"
        },
        "project": {
          "$ref": "#/$defs/TeamProjectReference"
        },
        "defaultBranch": {
          "type": "string",
          "description": "Default branch reference (e.g., refs/heads/main)"
        },
        "remoteUrl": {
          "type": "string",
          "format": "uri",
          "description": "HTTPS clone URL for the repository"
        },
        "sshUrl": {
          "type": "string",
          "description": "SSH clone URL for the repository"
        },
        "webUrl": {
          "type": "string",
          "format": "uri",
          "description": "Web URL to browse the repository in the Azure DevOps portal"
        },
        "size": {
          "type": "integer",
          "format": "int64",
          "description": "Compressed size of the repository in bytes"
        },
        "isFork": {
          "type": "boolean",
          "description": "True if the repository was created as a fork"
        },
        "isDisabled": {
          "type": "boolean",
          "description": "True if the repository is disabled"
        },
        "isInMaintenance": {
          "type": "boolean",
          "description": "True if the repository is in maintenance mode"
        },
        "parentRepository": {
          "$ref": "#/$defs/GitRepositoryRef"
        },
        "_links": {
          "type": "object",
          "description": "HAL reference links",
          "additionalProperties": true
        }
      }
    },
    "GitRepositoryRef": {
      "type": "object",
      "description": "Shallow reference to a Git repository",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Repository ID"
        },
        "name": {
          "type": "string",
          "description": "Repository name"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL"
        },
        "project": {
          "$ref": "#/$defs/TeamProjectReference"
        },
        "isFork": {
          "type": "boolean",
          "description": "True if the repository was created as a fork"
        },
        "remoteUrl": {
          "type": "string",
          "description": "HTTPS clone URL"
        },
        "sshUrl": {
          "type": "string",
          "description": "SSH clone URL"
        },
        "collection": {
          "$ref": "#/$defs/TeamProjectCollectionReference"
        }
      }
    },
    "GitStatus": {
      "type": "object",
      "description": "Status metadata posted by a service or extension against a commit or pull request, such as build results or policy checks.",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int32",
          "description": "Status identifier"
        },
        "state": {
          "type": "string",
          "enum": [
            "notSet",
            "pending",
            "succeeded",
            "failed",
            "error",
            "notApplicable"
          ],
          "description": "State of the status"
        },
        "description": {
          "type": "string",
          "description": "Status description"
        },
        "context": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "Name of the status context"
            },
            "genre": {
              "type": "string",
              "description": "Genre of the status"
            }
          }
        },
        "targetUrl": {
          "type": "string",
          "format": "uri",
          "description": "URL with status details"
        },
        "createdBy": {
          "$ref": "#/$defs/IdentityRef"
        },
        "creationDate": {
          "type": "string",
          "format": "date-time"
        },
        "updatedDate": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "GitUserDate": {
      "type": "object",
      "description": "User info and date for Git operations",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the user"
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "Email address of the user"
        },
        "date": {
          "type": "string",
          "format": "date-time",
          "description": "Date of the Git operation"
        },
        "imageUrl": {
          "type": "string",
          "format": "uri",
          "description": "Avatar URL for the user"
        }
      }
    },
    "IdentityRef": {
      "type": "object",
      "description": "Reference to an Azure DevOps identity (user or group)",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Unique identity ID"
        },
        "displayName": {
          "type": "string",
          "description": "Display name of the identity"
        },
        "uniqueName": {
          "type": "string",
          "description": "Unique name (typically email)"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL for this identity"
        },
        "imageUrl": {
          "type": "string",
          "format": "uri",
          "description": "URL to the identity's avatar image"
        },
        "descriptor": {
          "type": "string",
          "description": "Graph descriptor for the identity"
        },
        "isContainer": {
          "type": "boolean",
          "description": "Whether this identity is a group"
        }
      }
    },
    "IdentityRefWithVote": {
      "type": "object",
      "description": "Identity information including a vote on a pull request. Vote values are 10 (approved), 5 (approved with suggestions), 0 (no vote), -5 (waiting for author), -10 (rejected).",
      "allOf": [
        {
          "$ref": "#/$defs/IdentityRef"
        },
        {
          "type": "object",
          "properties": {
            "vote": {
              "type": "integer",
              "format": "int16",
              "description": "Vote value: 10=approved, 5=approved with suggestions, 0=no vote, -5=waiting for author, -10=rejected"
            },
            "reviewerUrl": {
              "type": "string",
              "format": "uri",
              "description": "URL to retrieve reviewer information"
            },
            "hasDeclined": {
              "type": "boolean",
              "description": "Whether the reviewer has declined to review"
            },
            "isFlagged": {
              "type": "boolean",
              "description": "Whether the reviewer is flagged for attention"
            },
            "isRequired": {
              "type": "boolean",
              "description": "Whether this is a required reviewer"
            },
            "votedFor": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/IdentityRefWithVote"
              },
              "description": "Groups or teams this reviewer contributed to"
            }
          }
        }
      ]
    },
    "ResourceRef": {
      "type": "object",
      "description": "Generic reference to a resource",
      "properties": {
        "id": {
          "type": "string",
          "description": "Resource ID"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Resource URL"
        }
      }
    },
    "TeamProjectCollectionReference": {
      "type": "object",
      "description": "Reference to a Team Project Collection",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Collection ID"
        },
        "name": {
          "type": "string",
          "description": "Collection name"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL for the collection"
        }
      }
    },
    "TeamProjectReference": {
      "type": "object",
      "description": "Shallow reference to an Azure DevOps team project",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Project ID"
        },
        "name": {
          "type": "string",
          "description": "Project name"
        },
        "description": {
          "type": "string",
          "description": "Project description"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL for the project"
        },
        "state": {
          "type": "string",
          "enum": [
            "deleting",
            "new",
            "wellFormed",
            "createPending",
            "all",
            "unchanged",
            "deleted"
          ],
          "description": "Current state of the project"
        },
        "visibility": {
          "type": "string",
          "enum": [
            "private",
            "public"
          ],
          "description": "Visibility of the project"
        },
        "revision": {
          "type": "integer",
          "format": "int64",
          "description": "Project revision number"
        },
        "lastUpdateTime": {
          "type": "string",
          "format": "date-time",
          "description": "Last update time"
        }
      }
    },
    "WebApiTagDefinition": {
      "type": "object",
      "description": "Tag definition for pull request labels",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Tag ID"
        },
        "name": {
          "type": "string",
          "description": "Tag name"
        },
        "active": {
          "type": "boolean",
          "description": "Whether the tag is active"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "REST API URL for the tag"
        }
      }
    }
  }
}