File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export default class Models extends Component {
5959 const rawSchema = specSelectors . specJson ( ) . getIn ( fullPath , Im . Map ( ) )
6060 const displayName = schema . get ( "title" ) || rawSchema . get ( "title" ) || name
6161
62- if ( layoutSelectors . isShown ( [ "models" , name ] , false ) && schema === undefined ) {
62+ if ( layoutSelectors . isShown ( [ "models" , name ] , false ) && ( schema . size === 0 && rawSchema . size > 0 ) ) {
6363 // Firing an action in a container render is not great,
6464 // but it works for now.
6565 this . props . specActions . requestResolvedSubtree ( [ ...this . getSchemaBasePath ( ) , name ] )
Original file line number Diff line number Diff line change 1+ swagger : " 2.0"
2+
3+ paths :
4+ / :
5+ get :
6+ description : wow
7+
8+ definitions :
9+ MyModel :
10+ type : object
11+ properties :
12+ a :
13+ type : string
Original file line number Diff line number Diff line change 1+ import repeat from "lodash/repeat"
2+
3+ describe ( "Editor #1868: model changes break rendering" , ( ) => {
4+ it ( "should render model content changes correctly" , ( ) => {
5+ cy
6+ . visit ( "/?url=/documents/bugs/editor-1868.yaml" )
7+
8+ . get ( ".model-toggle.collapsed" )
9+ . click ( )
10+
11+ . get ( "#model-MyModel" )
12+ . contains ( "a" )
13+
14+ . window ( )
15+ . then ( win => {
16+ // Simulate Swagger Editor updating a model
17+ const content = win . ui . specSelectors . specStr ( )
18+ win . ui . specActions . updateSpec ( content + `\n b:\n type: string` )
19+ } )
20+
21+ . get ( "#model-MyModel" )
22+ . contains ( "a" )
23+ . get ( "#model-MyModel" )
24+ . contains ( "b" )
25+ } )
26+ } )
You can’t perform that action at this time.
0 commit comments