mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-27 11:03:43 +03:00
fix: respect description defined on the property level with $ref even if referred object has default description (#703)
This commit is contained in:
parent
46f5ea7b82
commit
ce87174213
|
@ -229,11 +229,18 @@ export class SchemaDereferencer {
|
|||
if ( keysCount > 2 || (keysCount === 2 && !schema.description) ) {
|
||||
WarningsService.warn(`Other properties are defined at the same level as $ref at "#${pointer}". ` +
|
||||
'They are IGNORED according to the JsonSchema spec');
|
||||
resolved.description = resolved.description || schema.description;
|
||||
}
|
||||
|
||||
resolved = this.normalizator.normalize(resolved, $ref);
|
||||
this._refCouner.exit($ref);
|
||||
|
||||
// schema description should always override $ref description
|
||||
if (schema.description) {
|
||||
// make a copy of resolved object with updated description, do not globally override the description
|
||||
resolved = Object.assign({}, resolved);
|
||||
resolved.description = schema.description;
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user