diff --git a/README.md b/README.md index 9bfeb5aa..769cbe86 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ configUrl | Configs URL parameterMacro | MUST be a function. Function to set default value to parameters. Accepts two arguments parameterMacro(operation, parameter). Operation and parameter are objects passed for context, both remain immutable modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable docExpansion | Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing). The default is 'list'. +displayOperationId | Controls the display of operationId in operations list. The default is `false`. ### Plugins diff --git a/src/core/components/operation.jsx b/src/core/components/operation.jsx index 30836814..91a68544 100644 --- a/src/core/components/operation.jsx +++ b/src/core/components/operation.jsx @@ -17,6 +17,8 @@ export default class Operation extends React.Component { allowTryItOut: PropTypes.bool, + displayOperationId: PropTypes.bool, + response: PropTypes.object, request: PropTypes.object, @@ -35,6 +37,7 @@ export default class Operation extends React.Component { showSummary: true, response: null, allowTryItOut: true, + displayOperationId: false, } constructor(props, context) { @@ -108,6 +111,7 @@ export default class Operation extends React.Component { response, request, allowTryItOut, + displayOperationId, fn, getComponent, @@ -126,6 +130,7 @@ export default class Operation extends React.Component { let produces = operation.get("produces") let schemes = operation.get("schemes") let parameters = getList(operation, ["parameters"]) + let operationId = operation.get("__originalOperationId") const Responses = getComponent("responses") const Parameters = getComponent( "parameters" ) @@ -162,6 +167,8 @@ export default class Operation extends React.Component { } + { displayOperationId && operationId ? {operationId} : null } + { (!security || !security.count()) ? null : @@ -90,6 +86,8 @@ export default class Operations extends React.Component { request={ request } allowTryItOut={allowTryItOut} + displayOperationId={displayOperationId} + specActions={ specActions } specSelectors={ specSelectors } diff --git a/src/core/index.js b/src/core/index.js index 8f3f4844..c68124d4 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -8,7 +8,7 @@ import { parseSeach, filterConfigs } from "core/utils" const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion", "apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl", - "showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro" ] + "showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro", "displayOperationId" ] // eslint-disable-next-line no-undef const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION } = buildInfo @@ -28,6 +28,7 @@ module.exports = function SwaggerUI(opts) { validatorUrl: "https://online.swagger.io/validator", configs: {}, custom: {}, + displayOperationId: false, // Initial set of plugins ( TODO rename this, or refactor - we don't need presets _and_ plugins. Its just there for performance. // Instead, we can compile the first plugin ( it can be a collection of plugins ), then batch the rest. diff --git a/src/style/_layout.scss b/src/style/_layout.scss index 8bfe29e2..278cc8f4 100644 --- a/src/style/_layout.scss +++ b/src/style/_layout.scss @@ -209,9 +209,10 @@ body } .opblock-summary-path, + .opblock-summary-operation-id, .opblock-summary-path__deprecated { - font-size: 16px; + font-size: 13px; display: flex; @@ -247,6 +248,16 @@ body text-decoration: line-through; } + .opblock-summary-path + { + font-size: 13px; + } + + .opblock-summary-operation-id + { + font-size: 16px; + } + .opblock-summary-description { font-size: 13px;