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
Exclude oazapt’s default headers from generated function parameters #509
Comments
I am currently using |
Hmm. I understand the problem, thanks for bringing this up! That said, I'm not entirely sure if it's worth extending the api of this lib for this. Without digging really deep into this I'd initially argue that when a header is valid and constant for each method of an API it should not be part of the endpoint-spec but instead part of a global configuration. Meaning, removing the parameter from the spec. Even for externally provided specs I'd consider adding a "we know better"-pre-processing of the spec before feeding it into oazapfts a pattern I'd favor here. Let me know what you think |
- stop setting Content-Type header for multipart requests - support HeaderInit in request objects - support default headers BREAKING CHANGE: multipart/form-data headers are not set by oazapfts anymore as these are usually automatically set by the browser/node when this causes problems on your end you can set Content-Type=multipart/form-data manually via RequestOpts oazapfts runtime now works with `Header` instead of plain Objects `{}`. This might affect you when you use a custom fetch implementation and manipulate headers there fix #512 ref #509
- stop setting Content-Type header for multipart requests - support HeaderInit in request objects - support default headers BREAKING CHANGE: multipart/form-data headers are not set by oazapfts anymore as these are usually automatically set by the browser/node when this causes problems on your end you can set Content-Type=multipart/form-data manually via RequestOpts oazapfts runtime now works with `Header` instead of plain Objects `{}`. This might affect you when you use a custom fetch implementation and manipulate headers there oazapfts no longer safe-guards "Content-Type" headers in the past we discarded custom Content-Type headers that didn't start with `json` for json requests and similarly Content-Type headers that didn't start with application/x-www-form-urlencoded for form requests we now trust you to set the correct headers for your requests -- fix #512 ref #509
- stop setting Content-Type header for multipart requests - support HeaderInit in request objects - support default headers BREAKING CHANGE: multipart/form-data headers are not set by oazapfts anymore as these are usually automatically set by the browser/node when this causes problems on your end you can set Content-Type=multipart/form-data manually via RequestOpts oazapfts runtime now works with `Header` instead of plain Objects `{}`. This might affect you when you use a custom fetch implementation and manipulate headers there oazapfts no longer safe-guards "Content-Type" headers in the past we discarded custom Content-Type headers that didn't start with `json` for json requests and similarly Content-Type headers that didn't start with application/x-www-form-urlencoded for form requests we now trust you to set the correct headers for your requests -- fix #512 ref #509
The docs recommend setting defaults for commonly used parameters.
Unfortunately they are still included in the generated functions, when they are specified in the spec.
Here is an example schema:
The
x-some-info
header is required on the request, which means it should also appear in the schema.But since I want it on almost every request, I would add it to the oazapfts defaults:
When I use oazapfts now to generate my api, the resulting function looks like this:
This forces me to add
xSomeInfo
every time, even if I know it will be supplied by the defaults.It would be nice to pass a list of headers to oazapfts that should be ignored during code generation.
I am thinking of something like
or
The text was updated successfully, but these errors were encountered: