From 66cb3ff2c00ae208220cc987550b74b9eea3b332 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Fri, 14 Jul 2017 03:17:57 -0700 Subject: [PATCH] Use swagger-client opId helper to generate layout keys for operations --- src/core/components/operations.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/components/operations.jsx b/src/core/components/operations.jsx index 21e0e7ba..c9031651 100644 --- a/src/core/components/operations.jsx +++ b/src/core/components/operations.jsx @@ -1,5 +1,8 @@ import React from "react" import PropTypes from "prop-types" +import { helpers } from "swagger-client" + +const { opId } = helpers export default class Operations extends React.Component { @@ -96,13 +99,15 @@ export default class Operations extends React.Component { { operations.map( op => { - const operationId = - op.getIn(["operation", "__originalOperationId"]) || op.getIn(["operation", "operationId"]) || op.get("id") - const isShownKey = ["operations", tag, operationId] + const path = op.get("path", "") const method = op.get("method", "") const jumpToKey = `paths.${path}.${method}` + const operationId = + op.getIn(["operation", "operationId"]) || op.getIn(["operation", "__originalOperationId"]) || opId(op.get("operation"), path, method) || op.get("id") + const isShownKey = ["operations", tag, operationId] + const allowTryItOut = specSelectors.allowTryItOutFor(op.get("path"), op.get("method")) const response = specSelectors.responseFor(op.get("path"), op.get("method")) const request = specSelectors.requestFor(op.get("path"), op.get("method"))