Skip to content

path item $ref rendering #4381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
"build-core": "webpack --config webpack-dist.config.js --colors",
"build-standalone": "webpack --config webpack-dist-standalone.config.js --colors",
"predev": "npm install",
"dev": "npm-run-all --parallel hot-server open-localhost",
"dev": "npm-run-all --parallel hot-server",
"watch": "webpack --config webpack-watch.config.js --watch --progress",
"open-localhost": "node -e 'require(\"open\")(\"http://localhost:3200\")'",
"hot-server": "webpack-dev-server --host 0.0.0.0 --config webpack-hot-dev-server.config.js --inline --hot --progress --content-base dev-helpers/",
"deps-license": "license-checker --production --csv --out $npm_package_config_deps_check_dir/licenses.csv && license-checker --development --csv --out $npm_package_config_deps_check_dir/licenses-dev.csv",
"deps-size": "webpack -p --config webpack.check.js --json | webpack-bundle-size-analyzer >| $npm_package_config_deps_check_dir/sizes.txt",
Expand Down
3 changes: 2 additions & 1 deletion src/core/containers/OperationContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export default class OperationContainer extends PureComponent {

toggleShown =() => {
let { layoutActions, tag, operationId, isShown } = this.props
if(!isShown) {
const resolvedSubtree = this.getResolvedSubtree()
if(!isShown && resolvedSubtree === undefined) {
// transitioning from collapsed to expanded
this.requestResolvedSubtree()
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/plugins/spec/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const mergerFn = (oldVal, newVal) => {
return newVal
}

return Map().mergeWith(
return OrderedMap().mergeWith(
mergerFn,
oldVal,
newVal
Expand All @@ -66,7 +66,7 @@ const mergerFn = (oldVal, newVal) => {

export const specJsonWithResolvedSubtrees = createSelector(
state,
spec => Map().mergeWith(
spec => OrderedMap().mergeWith(
mergerFn,
spec.get("json"),
spec.get("resolvedSubtrees")
Expand Down Expand Up @@ -109,7 +109,7 @@ export const semver = createSelector(
)

export const paths = createSelector(
spec,
specJsonWithResolvedSubtrees,
spec => spec.get("paths")
)

Expand Down
16 changes: 16 additions & 0 deletions src/core/plugins/spec/wrap-actions.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import get from "lodash/get"

export const updateSpec = (ori, {specActions}) => (...args) => {
ori(...args)
specActions.parseToJson(...args)
}

export const updateJsonSpec = (ori, {specActions}) => (...args) => {
ori(...args)

specActions.invalidateResolvedSubtreeCache()

// Trigger resolution of any path-level $refs.
const [json] = args
const pathItems = get(json, ["paths"])
const pathItemKeys = Object.keys(pathItems)

pathItemKeys.forEach(k => {
const val = get(pathItems, [k])

if(val.$ref) {
specActions.requestResolvedSubtree(["paths", k])
}
})
}

// Log the request ( just for debugging, shouldn't affect prod )
Expand Down
Loading