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

Filter Illegal Header Fields #615

Closed
drothmaler opened this issue Feb 22, 2024 · 4 comments
Closed

Filter Illegal Header Fields #615

drothmaler opened this issue Feb 22, 2024 · 4 comments
Labels
enhancement New feature or request implemented requested feature has been implemented

Comments

@drothmaler
Copy link

According to the OpenApi Spcec there are certain header parameters, that are not allowed as part of the regular parameters specification in the Swagger Spec. These Headers (Accept, Content-Type and Authorization) are described using other OpenApi fields.

The FastEndpoints Swagger generation should respect/filter that, when processing properties marked with FromHeader.

@dj-nitehawk
Copy link
Member

it doesn't seem to be enforced for even minimal apis. just tried the following:

app.MapGet("/test", ([FromHeader] string accept) => Results.Ok(accept));

nswag generated a header parameter without any complains.

i pasted the generated swagger.json into https://editor.swagger.io/
no complains there either.

so i'm not sure if FE needs to worry about it if nobody else pays any attention to it...

swagger ui seems to just ignore any values entered in to these input boxes anyway.

@dj-nitehawk dj-nitehawk added the discussion this is a general discussion or opinion based argument label Feb 22, 2024
@drothmaler
Copy link
Author

drothmaler commented Feb 23, 2024

Well I was going to create an Issues there too, just started here, because you generally try to make things better than the others :-)
And it would be pretty easy to implement in OperationProcessor.Process, shouldn't it?

Some people/projects are pretty picky, when it comes to the formal correctness of specs. So I currently had to remove the headers in question from the typed Request object and access them by Context.Request instead...

Edit:
Also created matching requests for domaindrivendev/Swashbuckle.AspNetCore#2767 and RicoSuter/NSwag#4792
And in swagger-ui there is already a matching Issue swagger-api/swagger-ui#7486 and PR swagger-api/swagger-ui#7567

@dj-nitehawk
Copy link
Member

yeah i'll guess we should do it.
i'll add it when i get a chance...
if you'd like to do a PR, that would be fine too...

@dj-nitehawk dj-nitehawk added enhancement New feature or request up for grabs community contribution is needed for this issue and removed discussion this is a general discussion or opinion based argument labels Feb 23, 2024
@KateyBee
Copy link
Member

@drothmaler This has been implemented in v5.23.0.8-beta

@KateyBee KateyBee added implemented requested feature has been implemented and removed up for grabs community contribution is needed for this issue labels Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request implemented requested feature has been implemented
Development

No branches or pull requests

3 participants