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

fix: make body in readChanges optional #62

Merged
merged 2 commits into from
Feb 6, 2024
Merged

Conversation

ewanharris
Copy link
Member

Description

We currently require passing an object with type as an empty string when calling the OpenFgaClient.readChanges, this is because we do not mark the body param as optional, when in reality it is as it is not required to pass a type to the api, and based on our other SDKs this seems a perfectly valid usage.

This is only really obvious when using TypeScript as it will flag the issue, developers who aren't using TypeScript won't see anything wrong until their code runs and the SDK errors when trying to access body.type.

const response = await fgaClient.readChanges(); // Expected 1-2 arguments, but got 0. An argument for 'body' was not provided.

This PR proposes moving the body parameter to be optional, meaning that the above is now valid from a typechecking perspective and guards the property access so no runtime errors occur

It also includes a commit that updates the docstring on the read API as made in openfga/api#133 so that we don't have lingering changes

References

Generated from openfga/sdk-generator#304

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@ewanharris ewanharris requested a review from a team as a code owner February 6, 2024 15:32
@ewanharris ewanharris added this pull request to the merge queue Feb 6, 2024
Merged via the queue into main with commit 3997f23 Feb 6, 2024
19 checks passed
@ewanharris ewanharris deleted the fix/readChanges-no-type branch February 6, 2024 15:46
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