diff --git a/package.json b/package.json
index 895e22dd..1893dc7f 100644
--- a/package.json
+++ b/package.json
@@ -68,6 +68,7 @@
"redux-logger": "*",
"reselect": "2.5.3",
"sanitize-html": "^1.14.1",
+ "scroll-to-element": "^2.0.0",
"serialize-error": "2.0.0",
"shallowequal": "0.2.2",
"swagger-client": "3.0.17",
diff --git a/src/core/components/operations.jsx b/src/core/components/operations.jsx
index 921429b4..13fcd8ba 100644
--- a/src/core/components/operations.jsx
+++ b/src/core/components/operations.jsx
@@ -62,7 +62,10 @@ export default class Operations extends React.Component {
return (
-
layoutActions.show(isShownKey, !showTag)} className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag" }>
+ layoutActions.show(isShownKey, !showTag)}
+ className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag" }
+ id={isShownKey.join("-")}>
{tag}
{ !tagDescription ? null :
diff --git a/src/core/plugins/deep-linking/spec-wrap-actions.js b/src/core/plugins/deep-linking/spec-wrap-actions.js
index e69de29b..fc2580e5 100644
--- a/src/core/plugins/deep-linking/spec-wrap-actions.js
+++ b/src/core/plugins/deep-linking/spec-wrap-actions.js
@@ -0,0 +1,43 @@
+import scrollTo from "scroll-to-element"
+
+const SCROLL_OFFSET = -5
+let hasHashBeenParsed = false
+
+
+export const updateResolved = (ori, { layoutActions }) => (...args) => {
+ ori(...args)
+
+ if(window.location.hash && !hasHashBeenParsed ) {
+ let hash = window.location.hash.slice(1) // # is first character
+
+ if(hash[0] === "!") {
+ // Parse UI 2.x shebangs
+ hash = hash.slice(1)
+ }
+
+ if(hash[0] === "/") {
+ // "/pet/addPet" => "pet/addPet"
+ // makes the split result cleaner
+ // also handles forgotten leading slash
+ hash = hash.slice(1)
+ }
+
+ let [tag, operationId] = hash.split("/")
+
+ if(tag && operationId) {
+ // Pre-expand and scroll to the operation
+ scrollTo(`#operations-${tag}-${operationId}`, {
+ offset: SCROLL_OFFSET
+ })
+ layoutActions.show(["operations", tag, operationId], true)
+ } else if(tag) {
+ // Pre-expand and scroll to the tag
+ scrollTo(`#operations-tag-${tag}`, {
+ offset: SCROLL_OFFSET
+ })
+ layoutActions.show(["operations-tag", tag], true)
+ }
+ }
+
+ hasHashBeenParsed = true
+}