Skip to content

Add tag description in categories api - #1359

Open
prashantsrivastava6 wants to merge 6 commits into
ManageIQ:masterfrom
prashantsrivastava6:add_tag_description_in_categories_api
Open

prashantsrivastava6 wants to merge 6 commits into
ManageIQ:masterfrom
prashantsrivastava6:add_tag_description_in_categories_api

Conversation

@prashantsrivastava6

@prashantsrivastava6 prashantsrivastava6 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fix: Tag description missing from /api/categories tags subcollection

Problem

The "All Tags" tab in the UI showed "-" for tag descriptions because the
categories tags subcollection API did not return the description attribute.

Root Cause

  • Tag descriptions are not returned by the categories tags subcollection API.
  • The tag_attributes query parameter was not supported by the categories
    tags subcollection endpoint.
  • Only the default tag attributes were included in API responses.

Fix

  • Updated app/controllers/api/subcollections/tags.rb
  • Added support for the tag_attributes query parameter
  • Included requested tag attributes, including description, in the tags
    subcollection response

API Usage

GET /api/categories?expand=resources,tags
  &attributes=id,name,description,single_value,show,default,perf_by_tag
  &tag_attributes=id,name,description

@prashantsrivastava6
prashantsrivastava6 force-pushed the add_tag_description_in_categories_api branch from 8c2b460 to 2cbf9c2 Compare October 30, 2026 07:46
@miq-bot

miq-bot commented Oct 30, 2026

Copy link
Copy Markdown
Member

Checked commits prashantsrivastava6/manageiq-api@ed61fa2~...320788f with ruby 3.3.12, rubocop 1.91.0, haml-lint 0.78.0, and yamllint 1.37.1
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@Fryguy

Fryguy commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

There's multiple things going on here, and it's a little confusing. First off, we already have a way to add extra parameters that don't normally come back from a payload, but description should come back by default. Can you show what APi call you're making where it doesn't return the values you're expecting? That is where are you seeing this:

The "All Tags" tab in the UI showed "-" for tag descriptions because the categories tags subcollection API did not return the description attribute.

@Fryguy

Fryguy commented Oct 30, 2026

Copy link
Copy Markdown
Member

@jrafanie I wonder if this overlaps with your PR/Issue to allow attributes on subcollections?

@prashantsrivastava6

prashantsrivastava6 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @Fryguy ,
Thanks for the review.
The UI is using:
GET /api/categories?expand=resources,tags&attributes=id,name,description,single_value,show,default,perf_by_tag&tag_attributes=id,name,description,categorization
The issue is with the nested tags returned in the expanded tags subcollection.
For example, the category resource includes its description, but the tag resources only return attributes such as id, name, href and id_value. The requested tag description is not present in the response, which causes the UI to display "-" in the All Tags tab.
The UI is explicitly requesting tag descriptions through:
tag_attributes=id,name,description,categorization
but description is not included in the returned tag objects.
This PR adds support for returning the requested description attribute for tags in the expanded categories tags subcollection.
Regarding overlap with @jrafanie's work, I'm happy to align if there is already a generic solution for subcollection attributes. Please let me know if this should be folded into that effort instead.

@prashantsrivastava6

prashantsrivastava6 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @Fryguy ,

Friendly ping on this PR. I've addressed the review comments and added details about the API call and expected response.
Please let me know if any further changes are needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants