openfga / sdk-generator

OpenFGA Client SDK Generator
Apache License 2.0
16 stars 38 forks source link

Java SDK: support global Context for ListObject #331

Closed Didier-SimpleCommeDev closed 6 months ago

Didier-SimpleCommeDev commented 6 months ago

Checklist

Describe the problem you'd like to have solved

The Java ClientListObjectsRequest does not provide an Object context field, which is supported by the API, as documented in the ReST API. This is a blocking issue if any relation needs a context for evaluation. The .Net implementation does provide this field (and seem to add it to the request body – but I’m not quite fluent in C#).

Describe the ideal solution

The Java SDK object ClientListObjectsRequest offers a context(Object context) method and the dev.openfga.sdk.api.client.OpenFgaClient#listObjects adds this field to the request body.

Alternatives and current workarounds

Workaround: override the OpenFgaClient, override the listObjects method – not tested yet

References

No response

Additional context

No response

Didier-SimpleCommeDev commented 6 months ago

I could provide a PR if allowed by the maintainers (I don’t seem to have the rights on the repo at the moment). The code change is minor, I still have to figure out how to (unit-) test it.

rhamzeh commented 6 months ago

Thanks for the issues @Didier-SimpleCommeDev!

To add context you need to account for it in:

As for contributing the change, we follow the normal GitHub fork and PR process, see here: https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project

Didier-SimpleCommeDev commented 6 months ago

PR Pushed! Still in draft, something’s broken. I’ll avoid thread polution here and deal with the code-related issues in the PR comment section.