Open paulomorgado opened 9 months ago
Looks like this was due to filtering out the operations after they had their parameters and responses processed.
Changed to this and it works:
builder.Services.AddOpenApiDocument(settings =>
{
settings.DocumentName = "Weather";
InsertTagSelectorOperationProcessor(settings.OperationProcessors, ctx => ctx.OperationDescription.Operation.Tags.Contains("Weather"));
});
builder.Services.AddOpenApiDocument(settings =>
{
settings.DocumentName = "Fortunes";
InsertTagSelectorOperationProcessor(settings.OperationProcessors,ctx => ctx.OperationDescription.Operation.Tags.Contains("Fortunes"));
});
// ...
static void InsertTagSelectorOperationProcessor(OperationProcessorCollection operationProcessors, Func<OperationProcessorContext, bool> func)
{
var i = 0;
while (i < operationProcessors.Count)
{
if (operationProcessors[i++] is OperationTagsProcessor)
{
break;
}
}
if (i == operationProcessors.Count)
{
operationProcessors.Add(new OperationProcessor(func));
}
else
{
operationProcessors.Insert(i, new OperationProcessor(func));
}
}
I have this simple APIs:
If I try to produce 2 documents (one for each tag):
I get this for the Fortunes API:
This happens for both 13.20.0 and 14.0.0-preview012.
One way of working around this has been remving the definitions afterwards: