feat(license_templates): add Popular to LicenseTemplate

What does this MR do?

LicenseTemplate does not carry the popular key, so the value is dropped on both endpoints that send it.

GET /templates/licenses and GET /templates/licenses/:key both render API::Entities::License, which exposes it on line 7 of lib/api/entities/license.rb as expose :popular?, as: :popular. The exposure carries no condition, so every response includes the key. I confirmed it against gitlab.com, where both endpoints return popular today.

Documentation: https://docs.gitlab.com/api/templates/licenses/

One thing makes this easy to misread: ListLicenseTemplatesOptions already has a Popular field, but that is the popular query filter sent with the request, which is a different thing from the field in the response.

I placed the field after SourceURL because that is the position GitLab sends it in. One note for whoever maintains the docs page: its example response still shows a featured key, which neither the entity at v19.3.1-ee nor gitlab.com sends today, and that stale example is why popular was missed here. I have left the existing Featured field untouched, since removing an exported field would be a breaking change and does not belong in this merge request.

I found this while building gitlab-mcp-server, an MCP server that exposes GitLab through this SDK.

Is this a breaking change?

No. This adds one field to a response struct and leaves every existing field in place, Featured included, so every existing caller still compiles and behaves exactly as before.

How was this tested?

The existing list and get tests now serve "popular": true in their fixtures and assert the decoded value, so both endpoints fail if the tag is wrong. I checked that by breaking the tag and watching each of them fail on this field.

Related to #2300

Edited by José M. Requena Plens

Merge request reports

Loading
Loading