James Andrew Smith
James Andrew Smith

Reputation: 1568

Minimal API with Swagger not showing correct endpoints under version

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) =>
  {
  
  });

Upvotes: 0

Views: 45

Answers (0)

Related Questions