-
Hi, I have an endpoint with an upstream with a different number of path parameters than the downstream. I use a DelegatingHandler to execute custom logic and then pass the request along with the new parameters. Example: Upstream: But, this generates a problem in the Swagger UI, because it exposes the downstream path to this endpoint and at API Gateway level I don't have this Another problem that I have is that the body fields are different in the API Gateway, because I need two extra fields to execute the custom logic that this endpoint has, and the Swagger UI does not expose those parameters because the Downstream API doesn't need those two extra fields. Is there a way to change this behavior and modify the documentation that is being exposed? So that I can expose the upstream path and add those two extra fields to the body. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @LucasRufo, different parameter names are unfortunately a problem. Because we cannot match the gateway path to the paths from the documentation. You can try use Different parameter names, but it is unverified for this use case. It was designed for aggregation. Extra fields. You can try to do a custom post-process on the documentation before it is displayed: public string AlterUpstreamSwaggerJson(HttpContext context, string swaggerJson)
{
var swagger = JObject.Parse(swaggerJson);
// ... alter upstream json
return swagger.ToString(Formatting.Indented);
}
app.UseSwaggerForOcelotUI(opt => {
opt.ReConfigureUpstreamSwaggerJson = AlterUpstreamSwaggerJson;
}) |
Beta Was this translation helpful? Give feedback.
Hi @LucasRufo,
different parameter names are unfortunately a problem. Because we cannot match the gateway path to the paths from the documentation.
You can try use Different parameter names, but it is unverified for this use case. It was designed for aggregation.
Extra fields. You can try to do a custom post-process on the documentation before it is displayed: