Merge branch 'master' into bug/3658-add-enzyme-test-for-objectmodel
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from "react"
|
import React, { PureComponent } from "react"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
|
|
||||||
export default class Model extends Component {
|
export default class Model extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
schema: PropTypes.object.isRequired,
|
schema: PropTypes.object.isRequired,
|
||||||
getComponent: PropTypes.func.isRequired,
|
getComponent: PropTypes.func.isRequired,
|
||||||
@@ -35,7 +35,7 @@ export default class Model extends Component {
|
|||||||
const PrimitiveModel = getComponent("PrimitiveModel")
|
const PrimitiveModel = getComponent("PrimitiveModel")
|
||||||
let type = "object"
|
let type = "object"
|
||||||
let $$ref = schema && schema.get("$$ref")
|
let $$ref = schema && schema.get("$$ref")
|
||||||
|
|
||||||
// If we weren't passed a `name` but have a ref, grab the name from the ref
|
// If we weren't passed a `name` but have a ref, grab the name from the ref
|
||||||
if ( !name && $$ref ) {
|
if ( !name && $$ref ) {
|
||||||
name = this.getModelName( $$ref )
|
name = this.getModelName( $$ref )
|
||||||
@@ -44,11 +44,11 @@ export default class Model extends Component {
|
|||||||
if ( !schema && $$ref ) {
|
if ( !schema && $$ref ) {
|
||||||
schema = this.getRefSchema( name )
|
schema = this.getRefSchema( name )
|
||||||
}
|
}
|
||||||
|
|
||||||
const deprecated = specSelectors.isOAS3() && schema.get("deprecated")
|
const deprecated = specSelectors.isOAS3() && schema.get("deprecated")
|
||||||
isRef = isRef !== undefined ? isRef : !!$$ref
|
isRef = isRef !== undefined ? isRef : !!$$ref
|
||||||
type = schema && schema.get("type") || type
|
type = schema && schema.get("type") || type
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case "object":
|
case "object":
|
||||||
return <ObjectModel
|
return <ObjectModel
|
||||||
|
|||||||
Reference in New Issue
Block a user