Skip to content
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

Upcase issues #117

Merged
merged 2 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion jirate/jira_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ def func_from_path(filename, function, field, fields):
global _loaded_mods
# Load a function from a file and run that
import importlib.util
import sys
import os

full_fn = os.path.expanduser(filename)
Expand Down
26 changes: 23 additions & 3 deletions jirate/jira_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,26 @@ def in_string_list(vals):
}


# Custom field inputs for a few things
def in_sprint_field(value):
if isinstance(value, list):
value = value[0]
return in_number(value)


def in_issue_key(value):
if isinstance(value, list):
value = value[0]
return str(value).upper()


_custom_field_input = {
'com.pyxis.greenhopper.jira:gh-sprint': in_sprint_field,
'com.atlassian.jpo:jpo-custom-field-parent': in_issue_key,
'com.pyxis.greenhopper.jira:gh-epic-link': in_issue_key
}


# Because allowed Values can be very long and complicated, we
# want users to be able to provide, essentially, the minimum
# unique value to save keystrokes (and frustration).
Expand Down Expand Up @@ -160,10 +180,10 @@ def transmogrify_value(value, field_info):
schema = field_info['schema']
av = field_info['allowedValues'] if 'allowedValues' in field_info else None

if 'custom' in schema and schema['custom'] in _custom_field_input:
return _custom_field_input[schema['custom']](value)

if schema['type'] == 'array':
# Patch for Jira sprint - TODO: make more generic
if 'custom' in schema and schema['custom'] == "com.pyxis.greenhopper.jira:gh-sprint":
return in_number(value[0])
vals = allowed_value_validate(field_info['name'], parse_params(value), av)
try:
ret = _input_array_renderers[schema['items']](vals)
Expand Down