remove warning for title & ref

This commit is contained in:
eitanya 2017-03-15 13:03:48 +02:00
parent bedfa1622c
commit b071947e00

View File

@ -224,9 +224,13 @@ class SchemaDereferencer {
// if resolved schema doesn't have title use name from ref // if resolved schema doesn't have title use name from ref
resolved.title = resolved.title || JsonPointer.baseName($ref); resolved.title = resolved.title || JsonPointer.baseName($ref);
let keysCount = Object.keys(schema).filter(key => !key.startsWith('x-redoc')).length; let keysCount = Object.keys(schema)
.filter(key => !key.startsWith('x-redoc'))
.filter(key => key !== 'description')
.filter(key => key !== 'title')
.length;
if ( keysCount > 2 || (keysCount === 2 && !schema.description) ) { if ( keysCount > 1 ) {
WarningsService.warn(`Other properties are defined at the same level as $ref at "#${pointer}". ` + WarningsService.warn(`Other properties are defined at the same level as $ref at "#${pointer}". ` +
'They are IGNORED according to the JsonSchema spec'); 'They are IGNORED according to the JsonSchema spec');
resolved.description = resolved.description || schema.description; resolved.description = resolved.description || schema.description;