@@ -64,7 +64,7 @@ public void RegisterComponents(OpenApiDocument document)
6464        { 
6565            if  ( document ? . Components  ==  null )  return ; 
6666
67-             string  baseUri  =  document . BaseUri   +   OpenApiConstants . ComponentsSegment ; 
67+             string  baseUri  =  getBaseUri ( document ) ; 
6868            string  location ; 
6969
7070            // Register Schema 
@@ -139,6 +139,33 @@ public void RegisterComponents(OpenApiDocument document)
139139            } 
140140        } 
141141
142+         private  string  getBaseUri ( OpenApiDocument  openApiDocument ) 
143+         { 
144+             return  openApiDocument . BaseUri  +  OpenApiConstants . ComponentsSegment ; 
145+         } 
146+ 
147+         /// <summary> 
148+         /// Registers a schema for a document in the workspace 
149+         /// </summary> 
150+         /// <param name="openApiDocument">The document to register the schema for.</param> 
151+         /// <param name="openApiSchema">The schema to register.</param> 
152+         /// <param name="id">The id of the schema.</param> 
153+         /// <returns>true if the schema is successfully registered; otherwise false.</returns> 
154+         /// <exception cref="ArgumentNullException">openApiDocument is null</exception> 
155+         /// <exception cref="ArgumentNullException">openApiSchema is null</exception> 
156+         /// <exception cref="ArgumentNullException">id is null or empty</exception> 
157+         public  bool  RegisterSchemaForDocument ( OpenApiDocument  openApiDocument ,  OpenApiSchema  openApiSchema ,  string  id ) 
158+         { 
159+             Utils . CheckArgumentNull ( openApiDocument ) ; 
160+             Utils . CheckArgumentNull ( openApiSchema ) ; 
161+             Utils . CheckArgumentNullOrEmpty ( id ) ; 
162+ 
163+             var  baseUri  =  getBaseUri ( openApiDocument ) ; 
164+ 
165+             var  location  =  baseUri  +  ReferenceType . Schema . GetDisplayName ( )  +  ComponentSegmentSeparator  +  id ; 
166+ 
167+             return  RegisterComponent ( location ,  openApiSchema ) ; 
168+         } 
142169
143170        /// <summary> 
144171        /// Registers a component in the component registry. 
0 commit comments