Convert route_setting :tier to x-gitlab-tier OpenAPI annotation
Overview
As part of the OpenAPI Annotations - REST Endpoint Tier epic, we need to register :tier in the gitlab-grape-openapi gem's annotations configuration so that route_setting :tier, :ultimate (or :premium) on any EE Grape endpoint emits x-gitlab-tier: "ultimate" in the generated OpenAPI YAML.
This is the foundational backend issue — the same pattern as how x-gitlab-lifecycle was implemented in !225472 (merged).
Background
The gitlab-grape-openapi gem already supports a generic annotation pipeline:
config.annotationsinconfig/initializers/gitlab_grape_openapi.rbmapsroute_settingkeys to OpenAPI extension keys.OperationConverter#extract_annotationsreadsoptions[:settings]and emits those keys as OpenAPI extensions on each operation.Operation#to_hinjects them at the top level of the operation object.
Adding x-gitlab-tier requires only registering the mapping — no changes to the converter or model are needed.
Proposal
1. Register the annotation mapping
In config/initializers/gitlab_grape_openapi.rb, add to the config.annotations hash:
config.annotations = {
lifecycle: 'x-gitlab-lifecycle',
tier: 'x-gitlab-tier' # ← add this line
}2. Add example annotations to EE API files
Add route_setting :tier declarations to a small number of EE endpoints to validate end-to-end, for example:
# ee/lib/api/epics.rb
route_setting :tier, :premium
desc 'Get epics for the group' do
...
end
get ...# ee/lib/api/audit_events.rb
route_setting :tier, :premium
desc 'Get a list of audit events' do
...
end
get ...3. Regenerate the OpenAPI spec
Run bin/rake gitlab:openapi:v3:generate and confirm x-gitlab-tier appears correctly in the output YAML for annotated endpoints, and is absent for CE endpoints.
Acceptance Criteria
-
tier: 'x-gitlab-tier'added toconfig.annotationsin the initializer -
route_setting :tier, :premium→x-gitlab-tier: "premium"in generated spec -
route_setting :tier, :ultimate→x-gitlab-tier: "ultimate"in generated spec - Unannotated (CE) endpoints have no
x-gitlab-tierkey in the spec - At least two EE API files have example
route_setting :tierdeclarations - Gem specs updated/added to cover the new annotation key
- OpenAPI spec regenerated and committed
Related
- Parent epic: OpenAPI Annotations - REST Endpoint Tier
- Sibling issue (lifecycle): #587171 (closed)
- Reference MR (lifecycle): !225472 (merged)