-
-
Notifications
You must be signed in to change notification settings - Fork 892
add createmeta_84age implementation #1503
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
Conversation
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci fix myoy hook add docstrings
d834809
to
8d90b35
Compare
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.
Great start !!
Made some comments, it would also be great if we can get some tests in, let me know if you need help on that front.
I would have a look at the tests/resources/
folder
jira/client.py
Outdated
issuetype_id = _meta[0] | ||
except JIRAError: | ||
raise JIRAError( | ||
status_code=500, |
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.
status_code=500, |
We shouldn't try and set our own status code. I would just let this exception bubble up
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 could instead use the existing methods on the client to check if a project exists, for example like so:
Line 202 in 7846ac3
def _project_exists(self, project_key: str) -> bool: |
Might be making this its own method, and use it in the test harness as well.
jira/client.py
Outdated
|
||
def createmeta_v2( | ||
self, | ||
projectKey: Optional[str] = None, |
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.
@studioj did we decide what we wanted to do with the naming convention of new functions?
jira/client.py
Outdated
) | ||
|
||
if self.is_84_and_later(): | ||
DeprecationWarning("The `createmeta` is deprecated, use createmeta_v2") |
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 definitely cannot use a function name called _v2
.
Let's instead deprecate at the argument level.
e.g.
User passes projectKeys as a List[str]
if version > 9 raise ValueError
else if version is >8.4 - raise deprecation warning
The deprecation warning can be more detailed, explaining exactly what is wrong with the arguments and must include a link to the Atlassian docs where they describe this deprecation, ie: https://confluence.atlassian.com/jiracore/createmeta-rest-endpoint-to-be-removed-975040986.html
I might structure it like this:
def createmeta(...):
is_deprecation_msg_raised = false
def deprecate_or_raise(msg: str):
if self._version >= (9, 0, 0):
raise ValueError(msg)
elif self._version >= (9, 0, 0):
DeprecationWarning(f"From Jira version 9.0.0: {msg}") # might need to change the stacklevel for this to work as intended
if not isinstance(projectKeys, str) or ("," in projectKeys):
deprecate_or_raise("projectKeys must be a str of a single project key")
# and so on for other
...
if is_deprecation_msg_raised :
DeprecationWarning(
"Atlassian wil have deprecated the `/createmeta` endpoint in Jira version 9.0.0."
+ "Full details can be found on:"
+ "https://confluence.atlassian.com/jiracore/createmeta-rest-endpoint-to-be-removed-975040986.html"
)
In the above proposal, people will be warned about ways they can change the calls in preparation. Feel free to use another method if more appropriate
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.
sorry, i have to skip this activity till war in Ukraine is finished
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.
@dshvedchenko sorry to hear you're affected 😔 hope all is well for you! If you give write access to your fork, I'm more than happy to finish the job :)
I need this fix and will invest couple of days on it ... I'll try to reproduce a similar solution accounting for the comments provided here. |
need suggestions on how to automate tests for this. edit : https://github.com/pycontribs/jira/blob/main/.github/workflows/jira_server_ci.yml#L15 |
can we have a progress on this or on #1527 PRs |
Thank you again for all the effort on this PR @dshvedchenko, sorry that we went with the alternative PR this time. Hope you can contribute again in the future ! |
this is draft for implementation of createmeta required according to changes causing #1462