python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

[Feature] Add raw request method to Python SDK for calling arbitrary API endpoints

Open dyeam0 opened this issue 2 months ago • 1 comments

Checklist

Describe the problem you'd like to have solved

Currently, the SDK provides typed methods for specific API endpoints (check, write, read, etc.). However, there is no way to call arbitrary OpenFGA API endpoints that may not yet have dedicated SDK methods. This creates a gap when:

  • New OpenFGA API endpoints are released but SDK updates have not been implemented yet
  • Experimental endpoints need to be tested
  • Developers need a temporary alternative while waiting for official SDK support

Without a raw request method, developers are forced to either wait for SDK updates, or fork and modify the SDK code themselves, or call the OpenFGA API directly without the SDK, losing the benefits of SDK authentication, configuration, and error handling patterns. This reduces developer agility and creates friction in adopting new OpenFGA features.

Describe the ideal solution

Add a raw request method to the SDKs that allows developers to make arbitrary HTTP requests to any OpenFGA API endpoint while still leveraging the SDK's authentication, configuration, and error handling patterns.

This would provide an escape hatch for developers while maintaining consistency with the SDK's configuration. The typed methods would remain the recommended approach for standard API calls, while the raw request method provides flexibility during early adoption of new features.

Alternatives and current workarounds

  • Fork and modify the SDK code
  • Call the OpenFGA API directly without the SDK

Neither workaround is ideal.

References

  • SDK generator issue: https://github.com/openfga/sdk-generator/issues/658
  • OpenFGA roadmap item: https://github.com/openfga/roadmap/issues/88

Additional context

No response

dyeam0 avatar Nov 04 '25 21:11 dyeam0

A summary of the changes CodeRabbit can apply:

  • Add an SDK "raw_request" escape-hatch by implementing async and sync OpenFgaClient.raw_request methods (modified openfga_sdk/client/client.py and openfga_sdk/sync/client/client.py), plus accompanying tests (test/client/raw_request_test.py, test/sync/client/raw_request_test.py), documentation (docs/RawRequest.md, RAW_REQUEST_QUICK_REFERENCE.md, IMPLEMENTATION_SUMMARY.md, FEATURE_CHANGELOG.md), and runnable examples (example/raw-request/example.py, example/raw-request/README.md).

  • Add a new raw_request escape-hatch to both async and sync OpenFgaClient (implemented in openfga_sdk/client/client.py and openfga_sdk/sync/client/client.py), and include comprehensive support and delivery changes: add async and sync test suites (test/client/raw_request_test.py, test/sync/client/raw_request_test.py), full documentation and quick reference (docs/RawRequest.md, RAW_REQUEST_QUICK_REFERENCE.md), examples and README (example/raw-request/example.py, example/raw-request/README.md), and project metadata/changelog and implementation notes (FEATURE_CHANGELOG.md, IMPLEMENTATION_SUMMARY.md) so callers can invoke arbitrary OpenFGA endpoints while preserving SDK auth, retries, telemetry, and error handling.

  • [ ] ✅ Create PR with these edits
  • [ ] 📋 Get copyable edits

coderabbitai[bot] avatar Nov 04 '25 21:11 coderabbitai[bot]

@dyeam0 Hi! I’d like to work on this issue. Could you please confirm if it’s still open and if there are any specific guidelines or expectations before I get started?

kcbiradar avatar Nov 22 '25 07:11 kcbiradar