diff --git a/docs/docs/integration/json-transcoding.md b/docs/docs/integration/json-transcoding.md index f71f3fe00..890ed2ea6 100644 --- a/docs/docs/integration/json-transcoding.md +++ b/docs/docs/integration/json-transcoding.md @@ -26,6 +26,7 @@ builder.Services.AddMagicOnionJsonTranscodingSwagger(); 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")); }); @@ -50,3 +51,21 @@ app.Run(); ``` ![image](https://github.com/user-attachments/assets/a101cb00-c9ad-42b6-93d4-87c0d8d23773) + + + +## Troubleshooting + +If you encounter the following exception at runtime, adding `builder.Services.AddEndpointsApiExplorer();` can help resolve the issue. +```csharp +System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator': No constructor for type 'Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator' can be instantiated using services from the service container and default values.) +``` + + +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 +builder.Services.AddEndpointsApiExplorer(); +``` diff --git a/docs/i18n/ja/docusaurus-plugin-content-docs/current/integration/json-transcoding.md b/docs/i18n/ja/docusaurus-plugin-content-docs/current/integration/json-transcoding.md index 670cbba79..795068123 100644 --- a/docs/i18n/ja/docusaurus-plugin-content-docs/current/integration/json-transcoding.md +++ b/docs/i18n/ja/docusaurus-plugin-content-docs/current/integration/json-transcoding.md @@ -28,6 +28,7 @@ builder.Services.AddMagicOnionJsonTranscodingSwagger(); 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")); }); @@ -52,3 +53,21 @@ app.Run(); ``` ![image](https://github.com/user-attachments/assets/a101cb00-c9ad-42b6-93d4-87c0d8d23773) + + + +## トラブルシューティング + +実行時に以下のような例外が発生した場合、`builder.Services.AddEndpointsApiExplorer();` を追加することで解決できます。 +```csharp +System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator': No constructor for type 'Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator' can be instantiated using services from the service container and default values.) +``` + + +参考 +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 +builder.Services.AddEndpointsApiExplorer(); +```