floralvikings / jira-connector

NodeJS Wrapper for the Jira REST API
http://floralvikings.github.io/jira-connector/
MIT License
373 stars 180 forks source link

search.search returning wrong responses. #114

Closed AlistairHardy closed 5 years ago

AlistairHardy commented 6 years ago

I have 2 different JQL queries I've been testing with from the get go, both are confirmed working and valid. If I use those queries in Jira or through the rest API (using axios and basic auth) I get matching responses. If I use those queries with Jira-Connector.search.search(), one returns the incorrect amount of responses, the other comes back with { errorMessages: [ 'The value \'API Platform\' does not exist for the field \'component\'.' ], errors: {} } Completely at a loss as they're literally the same JQL queries.

The queries themselves are pretty similar, just looking at different components, one being full dev and the other having some support tickets mixed in.

var jira = new JiraClient({
  host: "test-jira.instance.foo",
  oauth: { ... }
});

jira.search.search(
  {
    jql:
      "(component in ('REDACTED') AND Sprint in openSprints() AND Sprint not in futureSprints())",
    maxResults: 10
  },
  (error, response) => {
    if (error) {
      console.log("Jira Connector REDACTED Error");
      console.log(error);
    } else {
      console.log("jira connector total REDACTED " + response.total);
    }
  }
);
jira.search.search(
  {
    jql:
      '(component in ("API Platform") AND Sprint in openSprints() AND Sprint not in futureSprints())',
    maxResults: 10
  },
  (error, response) => {
    if (error) {
      console.log("Jira Connector API Platoform Error");
      console.log(error);
    } else {
      console.log("jira connector total API Platform " + response.total);
    }
  }
);

axios({
  method: "post",
  url: "https://test-jira.instance.foo/rest/api/2/search",
  auth: { ... },
  headers: {
    "Content-Type": "application/json"
  },
  data: {
    jql:
      '(component in ("REDACTED") AND Sprint in openSprints() AND Sprint not in futureSprints())',
    maxResults: 10,
    fields: [
      "project",
      "status",
      "summary",
      "assignee",
      "customfield_10005",
      "customfield_10309",
      "customfield_10308",
      "customfield_10609"
    ]
  }
})
  .then(response => {
    console.log("axios REDACTED total " + response.data.total);
  })
  .catch(err => {
    console.log("Axios error on REDACTED");
    console.log(err.response.data);
  });

axios({
  method: "post",
  url: "https://test-jira.instance.foo/rest/api/2/search",
  auth: { ... },
  headers: {
    "Content-Type": "application/json"
  },
  data: {
    jql:
      '(component in ("API Platform") AND Sprint in openSprints() AND Sprint not in futureSprints())',
    maxResults: 10,
    fields: [
      "project",
      "status",
      "summary",
      "assignee",
      "customfield_10005",
      "customfield_10309",
      "customfield_10308",
      "customfield_10609"
    ]
  }
})
  .then(response => {
    console.log("axios API Platform total " + response.data.total);
  })
  .catch(err => {
    console.log("Axios error on API Platform");
    console.log(err.response.data);
  });

Changed one of the components to REDACTED as it's a bit too specific to our company while API Platform is as generic as it gets. Anyway, the above returns this

Jira Connector API Platoform Error
{ errorMessages:
   [ 'The value \'API Platform\' does not exist for the field \'component\'.' ],
  errors: {} }
axios API Platform total 52
axios REDACTED total 73
jira connector total REDACTED 60
floralvikings commented 5 years ago

This repository is only very lightly maintained; you are welcome to submit a pull request if there is behavior you'd like to add, I do occasionally check the PR list and merge code that is within the scope of this tool and doesn't include breaking changes.

If you have found a bug please indicate the desired behavior and provide a minimal example demonstrating the incorrect behavior; I do try to fix bugs as they come up but I have very little time to devote to this repository anymore, so I can't make any guarantees.

If you have a feature you'd like to request, please indicate the desired behavior. I will almost certainly never have the time to implement it myself but this repository does see occasional PR activity so it may be added by a generous contributor. You are, of course, welcome to submit a pull request yourself implementing the desired behavior.

MrRefactoring commented 5 years ago

Solved in 2.12.0 version