Skip to content

Commit 32a2346

Browse files
committed
fix: add server to components
1 parent 68f9cbe commit 32a2346

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/ByteBard.AsyncAPI/AsyncApiWorkspace.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,24 @@ public void RegisterComponents(AsyncApiDocument document)
203203
{
204204
this.RegisterComponent(location + "/messages/" + message.Key, message.Value);
205205
}
206+
207+
string serverBaseUri = "#/servers/";
208+
foreach (var server in document.Servers)
209+
{
210+
var registerableServerValue = server.Value;
211+
if (server.Value is IAsyncApiReferenceable reference)
212+
{
213+
if (reference.Reference.IsExternal)
214+
{
215+
continue;
216+
}
217+
218+
registerableServerValue = this.ResolveReference<AsyncApiServer>(reference.Reference);
219+
}
220+
221+
location = serverBaseUri + server.Key;
222+
this.RegisterComponent(location, registerableServerValue);
223+
}
206224
}
207225
}
208226

0 commit comments

Comments
 (0)