Add server variables support to OpenAPI spec

What does this MR do and why?

  • This change makes GitLab's OpenAPI documentation more flexible by allowing it to work with different GitLab installations, not just gitlab.com.

  • Previously, the API documentation was hardcoded to only point to "https://gitlab.com/api". Now it uses a template format "https://{hostname}/api" where the hostname can be customized. This means organizations running their own private GitLab servers can use the same API documentation by simply changing the hostname variable to match their server's address. This retains gitlab.com as the default, so as not to break the current implementation.

  • ServerVariables render correctly within Scalar:

Screenshot_2026-02-16_at_13.49.42

Screenshot_2026-02-16_at_13.49.35

References

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #586604 (closed)

Merge request reports

Loading