feat(try-it-out): display validation error messages (#8212)
This commit is contained in:
@@ -112,6 +112,8 @@ export default class Operation extends PureComponent {
|
||||
|
||||
let onChangeKey = [ path, method ] // Used to add values to _this_ operation ( indexed by path and method )
|
||||
|
||||
const validationErrors = specSelectors.validationErrors([path, method])
|
||||
|
||||
return (
|
||||
<div className={deprecated ? "opblock opblock-deprecated" : isShown ? `opblock opblock-${method} is-open` : `opblock opblock-${method}`} id={escapeDeepLinkPath(isShownKey.join("-"))} >
|
||||
<OperationSummary operationProps={operationProps} isShown={isShown} toggleShown={toggleShown} getComponent={getComponent} authActions={authActions} authSelectors={authSelectors} specPath={specPath} />
|
||||
@@ -189,6 +191,14 @@ export default class Operation extends PureComponent {
|
||||
</div> : null
|
||||
}
|
||||
|
||||
{ !tryItOutEnabled || !allowTryItOut || validationErrors.length <= 0 ? null : <div className="validation-errors errors-wrapper">
|
||||
Please correct the following validation errors and try again.
|
||||
<ul>
|
||||
{ validationErrors.map((error, index) => <li key={index}> { error } </li>) }
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div className={(!tryItOutEnabled || !response || !allowTryItOut) ? "execute-wrapper" : "btn-group"}>
|
||||
{ !tryItOutEnabled || !allowTryItOut ? null :
|
||||
|
||||
|
||||
Reference in New Issue
Block a user