未验证 提交 eb6c4340 编写于 作者: K kyle 提交者: GitHub

fix: resolved model data invalidation (via #4858)

上级 f1224e51
......@@ -59,7 +59,7 @@ export default class Models extends Component {
const rawSchema = specSelectors.specJson().getIn(fullPath, Im.Map())
const displayName = schema.get("title") || rawSchema.get("title") || name
if(layoutSelectors.isShown(["models", name], false) && schema === undefined) {
if(layoutSelectors.isShown(["models", name], false) && (schema.size === 0 && rawSchema.size > 0)) {
// Firing an action in a container render is not great,
// but it works for now.
this.props.specActions.requestResolvedSubtree([...this.getSchemaBasePath(), name])
......
swagger: "2.0"
paths:
/:
get:
description: wow
definitions:
MyModel:
type: object
properties:
a:
type: string
\ No newline at end of file
import repeat from "lodash/repeat"
describe("Editor #1868: model changes break rendering", () => {
it("should render model content changes correctly", () => {
cy
.visit("/?url=/documents/bugs/editor-1868.yaml")
.get(".model-toggle.collapsed")
.click()
.get("#model-MyModel")
.contains("a")
.window()
.then(win => {
// Simulate Swagger Editor updating a model
const content = win.ui.specSelectors.specStr()
win.ui.specActions.updateSpec(content + `\n b:\n type: string`)
})
.get("#model-MyModel")
.contains("a")
.get("#model-MyModel")
.contains("b")
})
})
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册