Fix unresolved OpenAPI references
What does this MR do and why?
Currently, any external references will not resolve correctly because the OpenAPI (Swagger) viewer is rendered in an iFrame, so external requests are blocked due to CORS.
This MR aims to resolve this issue by bundling the spec with its external references into one spec file before passing it to the iFrame.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Create an
openapi.yml
file containing an external reference:
openapi: 3.0.0
info:
title: Simple API
version: 1.0.0
paths:
/greeting:
$ref: './greeting.yaml'
- Create the external reference (e.g.
./greeting.yaml
):
get:
summary: Get a friendly greeting
responses:
'200':
description: A successful response
content:
text/plain:
example: Hello, World!
- Open the
openapi.yml
file created in Step 1 - The contents from
./greeting.yaml
should be rendered
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #381047 (closed)
Edited by Jacques Erasmus