Use swagger-client opId helper to generate layout keys for operations
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
|
import { helpers } from "swagger-client"
|
||||||
|
|
||||||
|
const { opId } = helpers
|
||||||
|
|
||||||
export default class Operations extends React.Component {
|
export default class Operations extends React.Component {
|
||||||
|
|
||||||
@@ -96,13 +99,15 @@ export default class Operations extends React.Component {
|
|||||||
<Collapse isOpened={showTag}>
|
<Collapse isOpened={showTag}>
|
||||||
{
|
{
|
||||||
operations.map( op => {
|
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 path = op.get("path", "")
|
||||||
const method = op.get("method", "")
|
const method = op.get("method", "")
|
||||||
const jumpToKey = `paths.${path}.${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 allowTryItOut = specSelectors.allowTryItOutFor(op.get("path"), op.get("method"))
|
||||||
const response = specSelectors.responseFor(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"))
|
const request = specSelectors.requestFor(op.get("path"), op.get("method"))
|
||||||
|
|||||||
Reference in New Issue
Block a user