-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quote project key in JQL query and provide failure printing. #254
base: main
Are you sure you want to change the base?
Conversation
For some reason Jira allows you to create projects that are also JQL keywords. Even when using the project ID #, the API will end up using the key. The result is that the response contains an error: ``` "Error in the JQL Query: 'DO' is a reserved JQL word. You must surround it in quotation marks to use it in a query. (line 1, character 13)" ``` Quoting the project key on the JQL should have no impacts and ensure that the proper query is done.
Prints the error returned by the JQL query if it fails.
🦋 Changeset detectedLatest commit: eb13a1d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thank you, please create a changeset. |
Ok - I believe it's there though I'm new to typescript projects/yarn packaging. |
@@ -58,7 +58,11 @@ export const getIssuesByFilter = async ( | |||
const issues: Issue[] = []; | |||
for (const project of projects) { | |||
const { projectKey, instance } = project; | |||
const jql = jqlQueryBuilder({ project: [projectKey], components, query }); | |||
const jql = jqlQueryBuilder({ | |||
project: ['"' + projectKey + '"'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a template string makes most sense here?
project: `"${projectKey}"`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be better to do it inside the "jqlQueryBuilder" function? We already escape the "components" argument in the same way. There is other uses of the "jqlQueryBuilder" as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! Modified that jql builder function to support it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were using single qoutes for escaping whitespaces in the "component" query. Can't we use the same for projects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - should updateIssuesByComponent also be updated to use the JQLBuilder as well?
const projectKeys = projects.map(project => project.projectKey).join(','); |
Context
Due to how JIRA project naming works, it will allow project keys with JQL reserved keywords. When used without quotes, the JQL will fail and throw an error message that you must quote them. Since quoting the project key has no downside, doing so will ensure compatibility regardless of project key.
Issue ticket number and link
Checklist before requesting a review