Skip to content

Fix imports for @swagger-api/apidom-reference

Lukas Eipert requested to merge update-swagger into master

What does this MR do and why?

Update dependency swagger-ui to v5.11.3

Update dependency swagger-client to 3.24.5

Fix imports for @swagger-api/apidom-reference

@swagger-api/apidom-reference makes use of the exports field in package.json. This is a ESM/nodeJS specific spec, defined here: https://nodejs.org/docs/latest-v18.x/api/packages.html#exports

It allows defining entrypoints for ESM packages. Webpack 4 doesn't support this part of the ESM spec, while Webpack 5 and Vite support it properly. It doesn't pose a problem usually, until the package starts using the defined entrypoints itself.

The package @swagger-api/apidom-reference started to rely on it internally. So Vite handles it fine, but webpack needed some custom aliases. These aliases are used in vite as well, and broke vite.

Instead of relying on aliases this implements a webpack 4 plugin which replaces the custom entry points with a proper link to the file. I really cannot wait for vite to replace webpack, so that we can get rid of this tech debt.

MR acceptance checklist

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

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Bundler Screenshot
Webpack swagger_webpack
Vite swagger_vite

How to set up and validate locally

  1. Download https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/api/openapi/openapi.yaml and upload it to your GDK
  2. Have a look at the file (preferably with both webpack and vite)
Edited by Lukas Eipert

Merge request reports