GitLab · JSON Structure

Gitlab Merge Request Structure

A GitLab merge request proposing changes from a source branch to be merged into a target branch within a project.

Type: object Properties: 33 Required: 5
CodePlatformSoftware DevelopmentSource Control

GitLab Merge Request is a JSON Structure definition published by GitLab, describing 33 properties, of which 5 are required. It conforms to the https://json-structure.org/meta/core/v0/# meta-schema.

Properties

id iid project_id title description state draft source_branch target_branch source_project_id target_project_id author assignees reviewers merge_user labels milestone detailed_merge_status sha merge_commit_sha squash_commit_sha squash references web_url upvotes downvotes user_notes_count changes_count created_at updated_at merged_at prepared_at closed_at

Meta-schema: https://json-structure.org/meta/core/v0/#

JSON Structure

Raw ↑
{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://gitlab.com/schemas/gitlab/merge-request.json",
  "name": "GitLab Merge Request",
  "description": "A GitLab merge request proposing changes from a source branch to be merged into a target branch within a project.",
  "type": "object",
  "required": [
    "id",
    "iid",
    "project_id",
    "title",
    "state"
  ],
  "properties": {
    "id": {
      "type": "int32",
      "description": "The globally unique identifier of the merge request."
    },
    "iid": {
      "type": "int32",
      "description": "The internal project-scoped ID of the merge request."
    },
    "project_id": {
      "type": "int32",
      "description": "The ID of the project the merge request belongs to."
    },
    "title": {
      "type": "string",
      "description": "The title of the merge request.",
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "description": "The description of the merge request, supporting Markdown syntax.",
      "maxLength": 1048576
    },
    "state": {
      "type": "string",
      "enum": [
        "opened",
        "closed",
        "merged",
        "locked"
      ],
      "description": "The current state of the merge request."
    },
    "draft": {
      "type": "boolean",
      "description": "Whether the merge request is in draft state and not ready for review."
    },
    "source_branch": {
      "type": "string",
      "description": "The name of the source branch containing the changes."
    },
    "target_branch": {
      "type": "string",
      "description": "The name of the target branch to merge changes into."
    },
    "source_project_id": {
      "type": "int32",
      "description": "The ID of the project containing the source branch."
    },
    "target_project_id": {
      "type": "int32",
      "description": "The ID of the project containing the target branch."
    },
    "author": {
      "$ref": "#/$defs/UserSummary"
    },
    "assignees": {
      "type": "array",
      "description": "Users assigned to review and merge this merge request.",
      "items": {
        "$ref": "#/$defs/UserSummary"
      }
    },
    "reviewers": {
      "type": "array",
      "description": "Users requested to review this merge request.",
      "items": {
        "$ref": "#/$defs/UserSummary"
      }
    },
    "merge_user": {
      "oneOf": [
        {
          "$ref": "#/$defs/UserSummary"
        },
        {
          "type": "null"
        }
      ],
      "description": "The user who merged the merge request."
    },
    "labels": {
      "type": "array",
      "description": "Labels applied to the merge request.",
      "items": {
        "type": "string"
      }
    },
    "milestone": {
      "oneOf": [
        {
          "$ref": "#/$defs/Milestone"
        },
        {
          "type": "null"
        }
      ],
      "description": "The milestone the merge request is associated with."
    },
    "detailed_merge_status": {
      "type": "string",
      "description": "The detailed merge readiness status of the merge request.",
      "enum": [
        "blocked_status",
        "broken_status",
        "checking",
        "ci_must_pass",
        "ci_still_running",
        "discussions_not_resolved",
        "draft_status",
        "external_status_checks",
        "mergeable",
        "not_approved",
        "not_open",
        "policies_denied",
        "unchecked"
      ]
    },
    "sha": {
      "type": "string",
      "description": "The HEAD commit SHA of the source branch."
    },
    "merge_commit_sha": {
      "type": "string",
      "description": "The SHA of the merge commit, set after merging."
    },
    "squash_commit_sha": {
      "type": "string",
      "description": "The SHA of the squash commit, set after squash merging."
    },
    "squash": {
      "type": "boolean",
      "description": "Whether the merge request is configured to squash commits on merge."
    },
    "references": {
      "$ref": "#/$defs/References"
    },
    "web_url": {
      "type": "uri",
      "description": "The URL to view the merge request in a browser."
    },
    "upvotes": {
      "type": "int32",
      "minimum": 0,
      "description": "The number of upvotes the merge request has received."
    },
    "downvotes": {
      "type": "int32",
      "minimum": 0,
      "description": "The number of downvotes the merge request has received."
    },
    "user_notes_count": {
      "type": "int32",
      "minimum": 0,
      "description": "The number of user-authored comments on the merge request."
    },
    "changes_count": {
      "type": "string",
      "description": "The number of files changed. May be a string for large diffs."
    },
    "created_at": {
      "type": "datetime",
      "description": "The date and time the merge request was created."
    },
    "updated_at": {
      "type": "datetime",
      "description": "The date and time the merge request was last updated."
    },
    "merged_at": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time the merge request was merged."
    },
    "prepared_at": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time the merge request was prepared for merging."
    },
    "closed_at": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time the merge request was closed without merging."
    }
  },
  "$defs": {
    "UserSummary": {
      "type": "object",
      "description": "A simplified representation of a GitLab user.",
      "required": [
        "id",
        "username"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "description": "The unique identifier of the user."
        },
        "username": {
          "type": "string",
          "description": "The username of the user."
        },
        "name": {
          "type": "string",
          "description": "The display name of the user."
        },
        "state": {
          "type": "string",
          "enum": [
            "active",
            "blocked",
            "deactivated"
          ],
          "description": "The current state of the user account."
        },
        "avatar_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "URL to the user's avatar image."
        },
        "web_url": {
          "type": "string",
          "format": "uri",
          "description": "URL to the user's GitLab profile page."
        }
      }
    },
    "Milestone": {
      "type": "object",
      "description": "A milestone that groups issues and merge requests by a target date.",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The unique identifier of the milestone."
        },
        "iid": {
          "type": "integer",
          "description": "The project-scoped ID of the milestone."
        },
        "project_id": {
          "type": "integer",
          "description": "The ID of the project the milestone belongs to."
        },
        "title": {
          "type": "string",
          "description": "The title of the milestone."
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "The description of the milestone."
        },
        "state": {
          "type": "string",
          "enum": [
            "active",
            "closed"
          ],
          "description": "The current state of the milestone."
        },
        "due_date": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "The due date of the milestone in YYYY-MM-DD format."
        },
        "web_url": {
          "type": "string",
          "format": "uri",
          "description": "URL to view the milestone in a browser."
        }
      }
    },
    "References": {
      "type": "object",
      "description": "Reference strings for the merge request.",
      "properties": {
        "short": {
          "type": "string",
          "description": "Short reference format, for example !42."
        },
        "relative": {
          "type": "string",
          "description": "Relative reference format including project path."
        },
        "full": {
          "type": "string",
          "description": "Full reference format including namespace and project path."
        }
      }
    }
  }
}