Skip to content

Making auth headers optional #52

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Making auth headers optional #52

wants to merge 1 commit into from

Conversation

pellicceama
Copy link
Collaborator

@pellicceama pellicceama commented Jan 27, 2025

Important

Make headers optional in createClient function and update package versions.

  • Behavior:
    • Make headers optional in createClient function in createClient.ts by modifying _ClientOptions type to use Omit and adding optional headers property.
  • Versioning:
    • Increment version in fetch-links/package.json from 0.0.21 to 0.0.22.
    • Increment version in sdk-openint/package.json from 0.1.13 to 0.1.15.

This description was created by Ellipsis for cff60da. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to cff60da in 37 seconds

More details
  • Looked at 55 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. packages/runtime/createClient.ts:28
  • Draft comment:
    Consider providing a default value for headers to 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.

@@ -24,7 +25,9 @@ import {HTTPError} from './HTTPError.js'
import type {FlattenOptions} from './utils.js'
import {flattenNestedObject} from './utils.js'

type _ClientOptions = NonNullable<Parameters<typeof _createClient>[0]>
type _ClientOptions = Omit<NonNullable<Parameters<typeof _createClient>[0]>, 'headers'> & {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Successfully merging this pull request may close these issues.

2 participants