@@ -120,7 +120,6 @@ export class DefinitionRegistry {
120120 this . currentPath = [ ] ;
121121 this . client = client ;
122122 this . #gatherDefinitions( map ) ;
123- this . #expandInheritanceChains( ) ;
124123 this . #expandReferences( ) ;
125124 }
126125
@@ -204,7 +203,7 @@ export class DefinitionRegistry {
204203
205204 #expandAllOf( base : any ) : any {
206205 const allOf = base . allOf ;
207-
206+ delete base . allOf ;
208207 if ( allOf === undefined ) {
209208 return base ;
210209 }
@@ -418,31 +417,9 @@ export class DefinitionRegistry {
418417 this . data . securityDefinitions . add ( path , name , data ) ;
419418 }
420419 }
421- }
422-
423- /**
424- * Ensures inheritance chains are expanded for polymorphic references in the `polymorphicMap`.
425- * This is to ensure than an inheritance chain A > B > C is fully expanded to reflect
426- * that both B and C are derived from A.
427- *
428- * This method iterates through all entries in the `polymorphicMap`, which maps references
429- * to their derived classes. For each key in the map, it:
430- * 1. Retrieves the base class associated with the reference key.
431- * 2. Logs an unresolved reference if the base class cannot be found.
432- * 3. Checks if any derived classes of the reference also have their own derived classes
433- * and combines them into the current set of derived classes.
434- * 4. Updates the base class with a `$derivedClasses` property containing the complete
435- * set of derived classes.
436- *
437- * Throws:
438- * - An `Error` if a reference cannot be parsed.
439- *
440- * Side Effects:
441- * - Updates the `$derivedClasses` property of base classes in the `polymorphicMap`.
442- * - Logs unresolved references using `logUnresolvedReference`.
443- */
444- #expandInheritanceChains( ) {
445- for ( const [ ref , derived_set ] of this . polymorphicMap . entries ( ) ) {
420+ // ensure each base class has a list of derived classes for use
421+ // when interpretting allOf.
422+ for ( const [ ref , set ] of this . polymorphicMap . entries ( ) ) {
446423 const refResult = parseReference ( ref ) ;
447424 if ( ! refResult ) {
448425 throw new Error ( `Could not parse reference: ${ ref } ` ) ;
@@ -452,17 +429,7 @@ export class DefinitionRegistry {
452429 this . logUnresolvedReference ( ref ) ;
453430 continue ;
454431 }
455- // check if refKey also has derived classes and combine them
456- for ( const derived of derived_set ) {
457- const derivedRef = parseReference ( derived ) ! . expandedRef ;
458- const match = this . polymorphicMap . get ( derivedRef ) ;
459- if ( match !== undefined ) {
460- for ( const item of match ) {
461- derived_set . add ( item ) ;
462- }
463- }
464- }
465- baseClass [ "$derivedClasses" ] = Array . from ( derived_set ) ;
432+ baseClass [ "$derivedClasses" ] = Array . from ( set ) ;
466433 }
467434 }
468435
0 commit comments