Skip to content

fix(jtk): issues search -o json omits custom fields #179

@rianjs

Description

@rianjs

Problem

jtk issues search --jql '...' -o json returns null for all custom fields, even when those fields have values on the tickets. This forces users to drop down to raw curl calls against the Jira REST API for any query that needs custom field data.

The inconsistency:

Command Custom fields in JSON?
jtk issue get <key> -o json Yes
jtk sprints issues <id> -o json Yes
jtk issues search --jql '...' -o json No — all null

Reproduction

# Single ticket — custom fields present
jtk issue get MON-4036 -o json | jq '{sp: .fields.customfield_10035, changeType: .fields.customfield_10005}'
# => {"sp": 3.0, "changeType": {"value": "Feature", ...}}

# JQL search — custom fields null
jtk issues search --jql 'key = MON-4036' -o json | jq '.[0] | {sp: .fields.customfield_10035, changeType: .fields.customfield_10005}'
# => {"sp": null, "changeType": null}

Root Cause (likely)

The Jira REST API search endpoint accepts a fields parameter to control which fields are returned. If issues search isn't passing custom fields in that parameter (or is using a hardcoded field list that only includes built-in fields), the API won't return them.

Proposed Fix

  1. Pass custom fields through: If the search endpoint supports a --fields flag, include custom fields. If not, don't restrict the fields parameter so Jira returns everything.
  2. Bonus: Add a --fields flag to jtk issues search so users can specify exactly which fields they want (mirrors the REST API's fields parameter). Example:
    jtk issues search --jql '...' --fields key,summary,customfield_10005,customfield_10035 -o json

Version

jtk version 1.0.43

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions