Skip to content

Bug 2081849 - Migrate Bug REST resource to native Mojo API: field metadata (fields, legal_values, flag_types) - #2785

Merged
dklawren merged 2 commits into
mozilla:masterfrom
Xzzz:bug-2081849
Oct 17, 2026
Merged

dklawren merged 2 commits into
mozilla:masterfrom
Xzzz:bug-2081849

Conversation

@Xzzz

@Xzzz Xzzz commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Ports fields, legal_values and flag_types from Bugzilla::WebService::Bug into a native Bugzilla::API::V1::BugField Mojo controller, following the earlier migrations in this series.

First of the four sub-bugs of 2081819. The rest of the legacy Bug module stays until 2081860.

Changes

  • Add Bugzilla/API/V1/BugField.pm, with the same responses as the legacy endpoints:
    • GET /rest/field/bug[/<id_or_name>]
    • GET /rest/field/bug/<field>[/<product_id>]/values
    • GET /rest/flag_types/<product>[/<component>]
    • OPTIONS on each of them
  • Remove the three methods, their helpers and POD from Bugzilla/WebService/Bug.pm, and their routes from Resources/Bug.pm.
  • GET parameters are handled as on the legacy REST server:
    • A path id or name is added to the query ids/names
    • product_id and component can come from the query string, the path wins
    • A JSON body on GET is ignored
  • Tests:
    • New qa/t/rest_flag_types.t (this endpoint had no test)
    • rest_field.t and rest_bug_legal_values.t cover the query parameter handling

Not carried over: ETag/304 and JSONP callback=, as in the other migrated V1 modules.

Test plan

  • GET /rest/field/bug, /rest/field/bug/<id>, /rest/field/bug/<name>
  • GET /rest/field/bug/bug_status?names=priority, expecting both fields
  • GET /rest/field/bug/priority?include_fields=id,name
  • GET /rest/field/bug/priority/values
  • GET /rest/field/bug/version/<product_id>/values and /rest/field/bug/version/values?product_id=<id>
  • GET /rest/field/bug/version/values without a product, expecting param_required
  • GET /rest/field/bug/version/<private product_id>/values logged out, expecting product_access_denied
  • GET /rest/flag_types/<product> and /rest/flag_types/<product>/<component>, logged out and as admin
  • OPTIONS /rest/flag_types/<product> returns Allow: GET

References

@dklawren dklawren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM r=dkl

@dklawren
dklawren merged commit 84ad0e3 into mozilla:master Oct 17, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants