@@ -455,6 +455,16 @@ public IEnumerable<OpenApiError> ResolveReferences()
455455 return resolver . Errors ;
456456 }
457457
458+ /// <summary>
459+ /// Walks the OpenApiDocument and sets the host document for all referenceable objects
460+ /// </summary>
461+ public void SetHostDocument ( )
462+ {
463+ var resolver = new HostDocumentResolver ( this ) ;
464+ var walker = new OpenApiWalker ( resolver ) ;
465+ walker . Walk ( this ) ;
466+ }
467+
458468 /// <summary>
459469 /// Load the referenced <see cref="IOpenApiReferenceable"/> object from a <see cref="OpenApiReference"/> object
460470 /// </summary>
@@ -562,49 +572,30 @@ internal IOpenApiReferenceable ResolveReference(OpenApiReference reference, bool
562572 switch ( reference . Type )
563573 {
564574 case ReferenceType . PathItem :
565- var resolvedPathItem = this . Components . PathItems [ reference . Id ] ;
566- resolvedPathItem . Description = reference . Description ?? resolvedPathItem . Description ;
567- resolvedPathItem . Summary = reference . Summary ?? resolvedPathItem . Summary ;
568- return resolvedPathItem ;
569-
575+ return Components . PathItems [ reference . Id ] ;
570576 case ReferenceType . Response :
571- var resolvedResponse = this . Components . Responses [ reference . Id ] ;
572- resolvedResponse . Description = reference . Description ?? resolvedResponse . Description ;
573- return resolvedResponse ;
577+ return Components . Responses [ reference . Id ] ;
574578
575579 case ReferenceType . Parameter :
576- var resolvedParameter = this . Components . Parameters [ reference . Id ] ;
577- resolvedParameter . Description = reference . Description ?? resolvedParameter . Description ;
578- return resolvedParameter ;
580+ return Components . Parameters [ reference . Id ] ;
579581
580582 case ReferenceType . Example :
581- var resolvedExample = this . Components . Examples [ reference . Id ] ;
582- resolvedExample . Summary = reference . Summary ?? resolvedExample . Summary ;
583- resolvedExample . Description = reference . Description ?? resolvedExample . Description ;
584- return resolvedExample ;
583+ return Components . Examples [ reference . Id ] ;
585584
586585 case ReferenceType . RequestBody :
587- var resolvedRequestBody = this . Components . RequestBodies [ reference . Id ] ;
588- resolvedRequestBody . Description = reference . Description ?? resolvedRequestBody . Description ;
589- return resolvedRequestBody ;
586+ return Components . RequestBodies [ reference . Id ] ;
590587
591588 case ReferenceType . Header :
592- var resolvedHeader = this . Components . Headers [ reference . Id ] ;
593- resolvedHeader . Description = reference . Description ?? resolvedHeader . Description ;
594- return resolvedHeader ;
589+ return Components . Headers [ reference . Id ] ;
595590
596591 case ReferenceType . SecurityScheme :
597- var resolvedSecurityScheme = this . Components . SecuritySchemes [ reference . Id ] ;
598- resolvedSecurityScheme . Description = reference . Description ?? resolvedSecurityScheme . Description ;
599- return resolvedSecurityScheme ;
592+ return Components . SecuritySchemes [ reference . Id ] ;
600593
601594 case ReferenceType . Link :
602- var resolvedLink = this . Components . Links [ reference . Id ] ;
603- resolvedLink . Description = reference . Description ?? resolvedLink . Description ;
604- return resolvedLink ;
595+ return Components . Links [ reference . Id ] ;
605596
606597 case ReferenceType . Callback :
607- return this . Components . Callbacks [ reference . Id ] ;
598+ return Components . Callbacks [ reference . Id ] ;
608599
609600 default :
610601 throw new OpenApiException ( Properties . SRResource . InvalidReferenceType ) ;
@@ -716,6 +707,12 @@ public JsonSchema FindSubschema(Json.Pointer.JsonPointer pointer, EvaluationOpti
716707 {
717708 throw new NotImplementedException ( ) ;
718709 }
710+
711+ internal JsonSchema ResolveJsonSchemaReference ( Uri reference )
712+ {
713+ var referencePath = string . Concat ( "https://registry" , reference . OriginalString . Split ( '#' ) . Last ( ) ) ;
714+ return ( JsonSchema ) SchemaRegistry . Global . Get ( new Uri ( referencePath ) ) ;
715+ }
719716 }
720717
721718 internal class FindSchemaReferences : OpenApiVisitorBase
0 commit comments