@@ -1737,7 +1737,7 @@ function isValidObject(object, schema, strict, cleanRef) {
1737
1737
}
1738
1738
1739
1739
if ( hasType ( cleanRef , 'undefined' ) ) {
1740
- strict = false ;
1740
+ cleanRef = false ;
1741
1741
}
1742
1742
1743
1743
/*
@@ -1753,7 +1753,7 @@ function isValidObject(object, schema, strict, cleanRef) {
1753
1753
if ( realType ) {
1754
1754
switch ( true ) {
1755
1755
case ! hasType ( realType . schema , 'undefined' ) :
1756
- isValid = isValidObject ( field , realType . schema ) ;
1756
+ isValid = isValidObject ( field , realType . schema , strict , cleanRef ) ;
1757
1757
break ;
1758
1758
case ! hasType ( realType . value , 'undefined' ) :
1759
1759
isValid = isValidEnum ( field , realType ) ;
@@ -1826,7 +1826,7 @@ function isValidObject(object, schema, strict, cleanRef) {
1826
1826
break ;
1827
1827
case 'string' :
1828
1828
if ( isCustomType ( realType ) ) {
1829
- isValid = isValidObject ( field , typeSchema ) ;
1829
+ isValid = isValidObject ( field , typeSchema , strict , cleanRef ) ;
1830
1830
} else {
1831
1831
if ( typeSchema === 'array' ) {
1832
1832
if ( getRealType ( field ) !== 'array' ) {
@@ -1907,6 +1907,11 @@ function isValidObject(object, schema, strict, cleanRef) {
1907
1907
return isValid ;
1908
1908
}
1909
1909
1910
+ // check if object
1911
+ if ( ! hasType ( object , 'object' ) ) {
1912
+ result = false ;
1913
+ $log . invalidType ( object , 'object' ) ;
1914
+ }
1910
1915
1911
1916
// type
1912
1917
for ( fieldName in object ) {
@@ -1952,7 +1957,7 @@ function isValidObject(object, schema, strict, cleanRef) {
1952
1957
for ( fieldName in schema ) {
1953
1958
field = schema [ fieldName ] ;
1954
1959
mandatory = field . mandatory ;
1955
- if ( hasType ( object [ fieldName ] , 'undefined' ) ) {
1960
+ if ( object && hasType ( object [ fieldName ] , 'undefined' ) ) {
1956
1961
if ( mandatory === true ) {
1957
1962
$log . missingProperty ( fieldName ) ;
1958
1963
result = false ;
0 commit comments