-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
Description
Q&A (please complete the following information)
- OS: Windows 10 Pro
- Browser: Chrome
- Version: 120.0.6099.217
- Method of installation: unpkg
- Swagger-UI version: 5.11.0
- Swagger/OpenAPI version: OpenAPI 3.1.0
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.1.0
info:
title: TEST
description: TEST
contact:
name: Ondrej Navratil
email: [email protected]
version: '1.0'
servers:
- url: localhost:8080
tags:
- name: TEST
paths:
/test-endpoint:
get:
summary: Test
operationId: test
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
examples: {}
description: MWE
tags:
- TEST
Swagger-UI configuration options:
<html>
<body>
<!--StartFragment-->
<script>
window.onload = function() {
window.ui = SwaggerUIBundle( {
url: "./openapi-dc3f5bb2902dbf447297b747be4c6301d6929a9d.yaml",
dom_id: '#swagger-ui',
// deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
//plugins: [
// SwaggerUIBundle.plugins.DownloadUrl
//],
layout: "StandaloneLayout"
});
};
</script>
<!--EndFragment-->
</body>
</html>?yourQueryStringConfig
Describe the bug you're encountering
I get error in the responses tab
😱 Could not render responses_Responses, see the console.
To reproduce...
Steps to reproduce the behavior:
- Try to render the sample yaml. Or any yaml with empty map in response examples.
Expected behavior
Responses render, without examples
Additional context or thoughts
I narrowed the problem down to
examples: {}Removing the empty examples map fixes the problem, it may be, however, hard to figure this out.
Nevertheless, the empty map is valid with regards to OAS specs, and should not cause these crashes.