openapi-typescript-codegen icon indicating copy to clipboard operation
openapi-typescript-codegen copied to clipboard

Ignore certain headers

Open ChristofFritz opened this issue 3 years ago • 3 comments

I'd like to be able to ignore certain or all headers from being integrated into the generated code.

I handle these headers in Angular via interceptors so having them in the generated code is useless/annoying and keeps me from using the generator.

ChristofFritz avatar Jul 27 '22 14:07 ChristofFritz

I was having this problem and as a temporary fix am using jq to preprocess the openapi spec and remove the header before generating, like this:

curl "$OPENAPI_URL" | jq 'del(.. | select(.name? == "x-sender"))' > ./.openapi.yml

piercetrey-figure avatar Oct 25 '22 18:10 piercetrey-figure

We're currently facing the same issue. We address our tenants via a global configuration setting the header and this is redundant. I still like to keep my openapi true to the spec - marking it required.

fermentfan avatar May 02 '23 21:05 fermentfan

This is also something I think is missing from the options, See https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/spring.md its an option there...

We have a custom resolver so don't find any value in updating the call sites every time the parameter changes.

Additionally our header name changes based on application configuration which can be set at runtime and thus we need to not have the header name hardcoded in the generated code.

juliusfriedman avatar Sep 05 '24 15:09 juliusfriedman