diff --git a/src/core/components/operation-summary.jsx b/src/core/components/operation-summary.jsx
index 5eb40e3828aa5612832e54492c0444b3e06ab55b..bed0b3b4dea0e5e07fe1b8005830086d8a9ea116 100644
--- a/src/core/components/operation-summary.jsx
+++ b/src/core/components/operation-summary.jsx
@@ -2,6 +2,7 @@ import React, { PureComponent } from "react"
import PropTypes from "prop-types"
import { Iterable, List } from "immutable"
import ImPropTypes from "react-immutable-proptypes"
+import toString from "lodash/toString"
export default class OperationSummary extends PureComponent {
@@ -63,7 +64,7 @@ export default class OperationSummary extends PureComponent {
{!showSummary ? null :
- {(resolvedSummary || summary).toString()}
+ {toString(resolvedSummary || summary)}
}
diff --git a/test/e2e-cypress/static/documents/bugs/5188.yaml b/test/e2e-cypress/static/documents/bugs/5188.yaml
index 814b95bb99273fe78a80e5c79345b8a926d78e1e..cb4d6205dabbf0bc71f14bb146fd62f13806b0b6 100644
--- a/test/e2e-cypress/static/documents/bugs/5188.yaml
+++ b/test/e2e-cypress/static/documents/bugs/5188.yaml
@@ -8,10 +8,17 @@ paths:
/pet:
get:
tags:
- - pet
+ - default
summary:
- $ref:
- operationId: addPet
+ whatever: 123
+ operationId: objectSummary
+ responses:
+ '405':
+ description: Invalid input
+ post:
+ tags:
+ - default
+ operationId: noSummary
responses:
'405':
description: Invalid input
\ No newline at end of file
diff --git a/test/e2e-cypress/tests/bugs/5188.js b/test/e2e-cypress/tests/bugs/5188.js
index 80050bbf8581623706de5b85fc378f1b756834dd..b9c8f18cfb9ed6860435bee194007e5e611dd440 100644
--- a/test/e2e-cypress/tests/bugs/5188.js
+++ b/test/e2e-cypress/tests/bugs/5188.js
@@ -2,9 +2,17 @@ describe("#5188: non-string operation summary value", () => {
it("should gracefully handle an object value for an operation summary", () => {
cy
.visit("?url=/documents/bugs/5188.yaml")
- .get("#operations-pet-addPet")
+ .get("#operations-default-objectSummary")
.click()
.get(".opblock-summary-description")
.contains("[object Object]")
- })
+ })
+ it("should gracefully handle a missing value for an operation summary", () => {
+ cy
+ .visit("?url=/documents/bugs/5188.yaml")
+ .get("#operations-default-noSummary")
+ .click()
+ // check for response rendering; makes sure the Operation itself rendered
+ .contains("Invalid input")
+ })
})