js-sdk
js-sdk copied to clipboard
Refactor Configuration Validation to Use assertParamExists for apiUrl Check
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
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
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
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.