Skip to content

Openapi 3.0.x basepath undefined error

Update: for current state and what is left to be done, see thread.

Summary

Openapi.yaml file that shows de api rest calls stopped working properly after a few days.

Steps to reproduce

I think it happens in any project that uses openapi version 3.0.x

Example Project

It happens both in my private repository and in several public ones that I have checked to verify that it was not an isolated error.

You can see it in your own repository https://gitlab.com/gitlab-org/gitlab/-/blob/f4f2034849cc7e10836b7ca72f6ade092949ba53/doc/api/openapi/openapi.yaml

What is the current bug behavior?

Could not resolve reference ($ref): Tried to resolve a relative URL, without having a basePath.

error_gitpng

Output of checks

This bug happens on GitLab.com

Possible workaround

As a workaround, we suggest using the local references in your OpenAPI specification file.

If they're generated automatically, please generate a single file. Example: https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/api/openapi/openapi_v2.yaml

Potential fix

A potential fix would be to resolve all the references in the backend and the frontend receives only the single specification file. This would be rendered without any issues.

Edited by Jacques Erasmus