Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/docs/integration/json-transcoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ builder.Services.AddSwaggerGen(options =>
{
// Reflect the XML documentation comments of the service definition in Swagger.
// To use this feature, you must enable the Generate XML Comments option in project options.
options.IncludeMagicOnionXmlComments(Path.Combine(AppContext.BaseDirectory, "JsonTranscodingSample.Shared.xml"));
options.IncludeMagicOnionXmlComments(typeof(IMyService).Assembly);
});

var app = builder.Build();
Expand Down Expand Up @@ -62,8 +62,8 @@ System.AggregateException: Some services are not able to be constructed (Error w
```


Reference
MSDN documentation for the usage of Swashbuckle.AspNetCore.Swagger used in MagicOnion.
Reference
MSDN documentation for the usage of Swashbuckle.AspNetCore.Swagger used in MagicOnion.
https://learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-8.0&tabs=visual-studio

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ builder.Services.AddSwaggerGen(options =>
{
// Reflect the XML documentation comments of the service definition in Swagger.
// To use this feature, you must enable the Generate XML Comments option in project options.
options.IncludeMagicOnionXmlComments(Path.Combine(AppContext.BaseDirectory, "JsonTranscodingSample.Shared.xml"));
options.IncludeMagicOnionXmlComments(typeof(IMyService).Assembly);
});

var app = builder.Build();
Expand Down Expand Up @@ -64,8 +64,8 @@ System.AggregateException: Some services are not able to be constructed (Error w
```


参考
MagicOnion で使用されている Swashbuckle.AspNetCore.Swagger の使用法が記録された MSDN ドキュメントです。
参考
MagicOnion で使用されている Swashbuckle.AspNetCore.Swagger の使用法が記録された MSDN ドキュメントです。
https://learn.microsoft.com/ja-jp/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-8.0&tabs=visual-studio

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ builder.Services.AddSwaggerGen(options =>
{
// Reflect the XML documentation comments of the service definition in Swagger.
// To use this feature, you must enable the Generate XML Comments option in project options.
options.IncludeMagicOnionXmlComments(Path.Combine(AppContext.BaseDirectory, "JsonTranscodingSample.Shared.xml"));
options.IncludeMagicOnionXmlComments(typeof(IMyService).Assembly);
});

var app = builder.Build();
Expand Down Expand Up @@ -63,8 +63,8 @@ System.AggregateException: Some services are not able to be constructed (Error w
```


참고
MagicOnion 에서 사용된 Swashbuckle.AspNetCore.Swagger 의 사용법이 기록된 MSDN 입니다.
참고
MagicOnion 에서 사용된 Swashbuckle.AspNetCore.Swagger 의 사용법이 기록된 MSDN 입니다.
https://learn.microsoft.com/ko-kr/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-8.0&tabs=visual-studio

```csharp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using JsonTranscodingSample.Shared;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
Expand All @@ -19,7 +21,7 @@
builder.Services.AddSwaggerGen(options =>
{
// Reflect the XML documentation comments of the service definition in Swagger.
options.IncludeMagicOnionXmlComments(Path.Combine(AppContext.BaseDirectory, "JsonTranscodingSample.Shared.xml"));
options.IncludeMagicOnionXmlComments(typeof(IMyFirstService).Assembly);

// // Add JWT security scheme to Swagger.
// options.AddJwtSecurityScheme();
Expand All @@ -42,4 +44,4 @@
app.MapMagicOnionService();
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");

app.Run();
app.Run();
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Reflection;
using System.Xml.Linq;
using MagicOnion.Server.JsonTranscoding.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
Expand All @@ -14,4 +15,11 @@ public static void IncludeMagicOnionXmlComments(this SwaggerGenOptions options,
{
options.AddOperationFilterInstance(new MagicOnionXmlCommentsOperationFilter(xmlDoc));
}

public static void IncludeMagicOnionXmlComments(this SwaggerGenOptions options, Assembly sharedAssembly)
{
IncludeMagicOnionXmlComments(options, XDocument.Load(
Path.Combine(AppContext.BaseDirectory, $"{sharedAssembly.GetName().Name}.xml")
));
}
}
Loading