Repository navigation
Making auth headers optional - #52
Open
pellicceama wants to merge 1 commit into
Open
pellicceama wants to merge 1 commit into
pellicceama wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
👍 Looks good to me! Reviewed everything up to cff60da in 37 seconds
More details
- Looked at
55lines of code in3files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. packages/runtime/createClient.ts:28
- Draft comment:
Consider providing a default value forheadersto ensure it is always an object, even if not provided. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The headers field is explicitly made optional with '?' in the type definition. The underlying _createClient function from openapi-fetch likely handles undefined headers appropriately. There's no evidence in the code that missing headers cause any issues. The type system will properly handle the optional nature of headers.
I might be missing potential runtime issues where undefined headers could cause problems. The underlying openapi-fetch implementation details aren't visible.
The TypeScript type system explicitly marks headers as optional, and this is a common pattern. If there were issues with undefined headers, they would likely be handled by the underlying openapi-fetch library.
The comment should be deleted as it suggests a solution to a problem that isn't evident, and the current type definition explicitly makes headers optional by design.
Workflow ID: wflow_gDCLLY1Xm0NDXVuZ
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
openint-bot
requested changes
Jan 27, 2025
| import {flattenNestedObject} from './utils.js' | ||
|
|
||
| type _ClientOptions = NonNullable<Parameters<typeof _createClient>[0]> | ||
| type _ClientOptions = Omit<NonNullable<Parameters<typeof _createClient>[0]>, 'headers'> & { |
Contributor
There was a problem hiding this comment.
I don't think making headers optional globally across all SDKs in the runtime layer is a good idea. Sometimes header is required, and it's not just about authentication, such as API_VERSION etc.
We'd need to invest more effort into make it optional vs. required per sdk, not globally so
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Make
headersoptional increateClientfunction and update package versions.headersoptional increateClientfunction increateClient.tsby modifying_ClientOptionstype to useOmitand adding optionalheadersproperty.fetch-links/package.jsonfrom0.0.21to0.0.22.sdk-openint/package.jsonfrom0.1.13to0.1.15.This description was created by
for cff60da. It will automatically update as commits are pushed.