You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been use Ocelot to build API gateway and MMLib.SwaggerForOcelot for API document. I used Custom Aggregator: TenantProvinceAggregator, WarehousesAddressAggregator. When I start the API Gateway, select Aggregates to view API document, the error will show:
And the stacktrace:
System.ArgumentException: An item with the same key has already been added. Key: GetTenantResponse
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at MMLib.SwaggerForOcelot.Aggregates.AggregateRouteDocumentationGenerator.CreateResponseSchema(IEnumerable`1 routes, SwaggerAggregateRoute aggregateRoute, OpenApiDocument openApiDocument)
at MMLib.SwaggerForOcelot.Aggregates.AggregateRouteDocumentationGenerator.GenerateDocs(SwaggerAggregateRoute aggregateRoute, IEnumerable`1 routes, OpenApiDocument openApiDocument)
at MMLib.SwaggerForOcelot.Aggregates.AggregateRouteDocumentationGenerator.GenerateDocs(SwaggerAggregateRoute aggregateRoute, OpenApiDocument openApiDocument)
at MMLib.SwaggerForOcelot.Aggregates.AggregatesDocumentFilter.Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath)
at MMLib.SwaggerForOcelot.Middleware.SwaggerForOcelotMiddleware.Invoke(HttpContext context, ISwaggerEndPointProvider swaggerEndPointRepository, IDownstreamSwaggerDocsRepository downstreamSwaggerDocs)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.MiddlewareAnalysis.AnalysisMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.MiddlewareAnalysis.AnalysisMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.MiddlewareAnalysis.AnalysisMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
The GetTenantResponse is the response of the TenantProvinceAggregator.
The TenantProvinceAggregator:
[AggregateResponse("Tenants with Province Name",typeof(PagingResponse<List<GetTenantResponse>>))]
public class TenantProvinceAggregator : IDefinedAggregator
{
public async Task<DownstreamResponse> Aggregate(List<HttpContext> responses)
{
// Remove the code to make it easier to see
}
}
The WarehousesAddressAggregator:
[AggregateResponse("Warehouses with Address Name", typeof(NonPagingResponse<List<GetAllWarehousesRespone>>))]
public class WarehousesAddressAggregator : IDefinedAggregator
{
public async Task<DownstreamResponse> Aggregate(List<HttpContext> responses)
{
// Removed the code to make it easier to see
}
}
When I commented the AggregateResponse of the WarehousesAddressAggregator as below, the API Gateway will show the API aggregate document, however, it's not my desire, I want to customize the aggregate response:
The text was updated successfully, but these errors were encountered:
I have been use Ocelot to build API gateway and MMLib.SwaggerForOcelot for API document. I used Custom Aggregator: TenantProvinceAggregator, WarehousesAddressAggregator. When I start the API Gateway, select Aggregates to view API document, the error will show:
And the stacktrace:
The GetTenantResponse is the response of the TenantProvinceAggregator.
The TenantProvinceAggregator:
The WarehousesAddressAggregator:
My configuration:
When I commented the AggregateResponse of the WarehousesAddressAggregator as below, the API Gateway will show the API aggregate document, however, it's not my desire, I want to customize the aggregate response:
The text was updated successfully, but these errors were encountered: