0

I have a problem when I switch version in the swagger UI. I see endpoints not related to that version they are associated with. For example I have 3 endpoints under version 1 but 1 endpoint under version 2. But the UI shows the 2 endpoints under version 1 as version 2.

Is there a way to only show the 1 endpoint set up in version 2?

my routes

public override void AddRoutes(IEndpointRouteBuilder app)
{
_vs = app.NewApiVersionSet()
    .HasApiVersion(new ApiVersion(1))
    .HasApiVersion(new ApiVersion(2))
    .Build();

app.MapPost("/{friendlyProcedureName}", RunProcess)
    .WithApiVersionSet(_vs)
    
app.MapGet("/{friendlyProcedureName}/Params", GetParamsByName)
    .WithApiVersionSet(_vs)

app.MapGet("/",  GetAllProcedures)
    .WithApiVersionSet(_vs)

app.MapGet("/", Mew)
    .WithApiVersionSet(_vs)
    .WithOpenApi()
    .MapToApiVersion(2);
}

I assume I need something like this but unsure how I can read from the data from the routes.

  options.DocInclusionPredicate((version, desc) =>
  {
  
  });
2
  • Does the solution in this thread useful to you ? Commented Feb 21 at 9:44
  • Could you also share definition of endpoints and the startup code (Program.cs) ? Commented Mar 5 at 8:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.