Skip to content

Conversation

@Waheedsys
Copy link
Contributor

Provide a brief summary of the changes

  • Ensured consistent error handling for missing apiUrl, maintaining backward compatibility with apiScheme and apiHost.
  • Simplified the validation logic for cleaner and more reusable code.

Description

Provide a detailed description of the changes

This PR refactors the validation logic in the Configuration class to improve error handling for the apiUrl parameter. The changes ensure consistent validation across parameters (apiUrl, apiScheme, and apiHost) and improve readability and maintainability by using the assertParamExists utility function.

References

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

Modified the OpenFgaClient constructor to throw a FgaRequiredParamError with a clear message
  when the apiUrl parameter is not provided.
@Waheedsys Waheedsys requested a review from a team as a code owner October 2, 2024 12:30
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 2, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

Co-authored-by: Ewan Harris <ewanharris93@gmail.com>
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.93%. Comparing base (10534cc) to head (93a7cbe).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #161      +/-   ##
==========================================
- Coverage   87.94%   87.93%   -0.02%     
==========================================
  Files          23       23              
  Lines        1120     1119       -1     
  Branches      171      171              
==========================================
- Hits          985      984       -1     
  Misses         83       83              
  Partials       52       52              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ewanharris ewanharris changed the title Refactor Configuration Validation to Use assertParamExists for apiUrl Check fix: error correctly if apiUrl is not provided Oct 18, 2024
Copy link
Member

@ewanharris ewanharris left a comment

Choose a reason for hiding this comment

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

Thanks @Waheedsys!

@ewanharris ewanharris added this pull request to the merge queue Oct 18, 2024
Merged via the queue into openfga:main with commit ac1e4bb Oct 18, 2024
9 checks passed
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.

3 participants