Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not consistent paths in IDocumentFilter #2645

Closed
CzBuCHi opened this issue May 8, 2023 · 1 comment
Closed

not consistent paths in IDocumentFilter #2645

CzBuCHi opened this issue May 8, 2023 · 1 comment

Comments

@CzBuCHi
Copy link

CzBuCHi commented May 8, 2023

i have declared this single mapping: app.MapPost("/User/Update/{userId:int}", (int userId) => Results.Ok());

now in document filter class:

class Filter : IDocumentFilter {
    public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) {
        var description in context.ApiDescriptions.First();

        var path = description.RelativePath;
        var key = swaggerDoc.Paths.Keys.First();

    }
}
  • path variable will be resolved as /User/Update/{userId:int}
  • key variable as /User/Update/{userId}

so i cannot simply compare these two and need to do regex magic to get rid of :int part from path ...

@Havunen
Copy link

Havunen commented Feb 18, 2024

Yes this is expected behavior because swaggerDoc.Paths will be actual Url path and description.relativePath is the API explorer template URI.

@martincostello martincostello closed this as not planned Won't fix, can't repro, duplicate, stale Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants