Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-12773

The source and target matcher fields should be consistently named between the GET and POST methods of the Default Reviewers APIs

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • API - REST
    • None
    • 2
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      Summary

      The source and target matcher fields are different between the GET and POST methods of the Default Reviewers REST APIs

      GET methods use "sourceRefMatcher" and "targetRefMatcher" while POST methods use "sourceMatcher" and "targetMatcher".

      Here's a sample response for a GET /rest/default-reviewers/1.0/projects/{projectKey}/conditions request:

      [
          {
              "id": 27,
              "scope": {
                  "type": "PROJECT",
                  "resourceId": 145
              },
              "sourceRefMatcher": {
                  "active": true,
                  "id": "ANY_REF_MATCHER_ID",
                  "displayId": "ANY_REF_MATCHER_ID",
                  "type": {
                      "id": "ANY_REF",
                      "name": "Any branch"
                  }
              },
              "targetRefMatcher": {
                  "active": true,
                  "id": "ANY_REF_MATCHER_ID",
                  "displayId": "ANY_REF_MATCHER_ID",
                  "type": {
                      "id": "ANY_REF",
                      "name": "Any branch"
                  }
              },
              "reviewers": [
                  {
                      "name": "user1",
                      "emailAddress": "user1@testdomain.com",
                      "id": 51,
                      "displayName": "User1",
                      "active": true,
                      "slug": "user1",
                      "type": "NORMAL",
                      "links": {
                          "self": [
                              {
                                  "href": "https://bitbucket.myhost.com/users/user1"
                              }
                          ]
                      }
                  }
              ],
              "requiredApprovals": 1
          }
      ]
      

      Here's a sample request payload for a POST /rest/default-reviewers/1.0/projects/{projectKey}/condition request

      {
          "sourceMatcher": {
              "active": true,
              "id": "ANY_REF_MATCHER_ID",
              "displayId": "ANY_REF_MATCHER_ID",
              "type": {
                  "id": "ANY_REF",
                  "name": "Any branch"
              }
          },
          "targetMatcher": {
              "active": true,
              "id": "ANY_REF_MATCHER_ID",
              "displayId": "ANY_REF_MATCHER_ID",
              "type": {
                  "id": "ANY_REF",
                  "name": "Any branch"
              }
          },
          "reviewers": [
              {
                  "name": "user1",
                  "emailAddress": "user1@testdomain.com",
                  "id": 51,
                  "displayName": "User1",
                  "active": true,
                  "slug": "user1",
                  "type": "NORMAL"
              }
          ],
          "requiredApprovals": 1
      }
      

      The difference can cause confusion on the field names to pass in the POST methods, especially since the Default Reviewers REST resources documentation is currently missing examples (this doc issue is tracked in ticket: BSERV-12665)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jmariano@atlassian.com JP Mariano
              Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: