ory / sdk

The place where ORY's SDKs are being auto-generated
Apache License 2.0
139 stars 86 forks source link

Ruby client is not compatible with current version of Keto #243

Open EvanDaley opened 1 year ago

EvanDaley commented 1 year ago

Preflight checklist

Describe the bug

The permission_api.rb file has the wrong paths.

image

In this example local_var_path should have the value 'check' not '/relation-tuples/check/openapi'

The expand_permissions_with_http_info method should have local_var_path = '/expand'.

Reproducing the bug

In order to point the ruby client at your local docker container, you also have to override the server_settings method in configuration.rb. Ideally this should be driven with an env variable.

    def server_settings
      [
        {
          # url: "https://{project}.projects.oryapis.com", <- This should be an env var or configurable thru the configure() method
          url: "http://localhost:4466",
          description: "No description provided",
          variables: {
            project: {
                description: "Project slug as provided by the Ory Console.",
                default_value: "playground",
              }
            }
        }
      ]
    end

Relevant log output

No response

Relevant configuration

No response

Version

Latest for both the client and keto docker image

On which operating system are you observing this issue?

Mac

In which environment are you deploying?

None

Additional Context

I'm happy to PR a fix for this. I would just need some guidance on your preferred process. Thanks 🙏

EvanDaley commented 1 year ago

Actually, after digging into it a bit more, it looks like the issue was because I was using the quickstart tutorial keto image and not the latest (oryd/keto:v0.7.0-alpha.1-sqlite vs v0.10.0-alpha.0).

aeneasr commented 1 year ago

Hey Evan, thank you for giving Ory a try and sorry to see that you're having trouble. You've created numerous issues in several repositories in a short time - would it be possible to summarize your findings in this issue please? I will close the other issues, because it's hard to keep track of everything

EvanDaley commented 1 year ago

Hey @aeneasr , thanks for the quick response. Sorry for the noise!

Yeah, I was using the version of the keto docker image from the quickstart tutorial (0.7.0), and that wasn't playing nice with the ruby gem. I thought that the gem was the problem, but it turned out to just be the mismatch between docker and gem vresions. The container older container calls the route check but the gem looks for /relation-tuples/check. Turns out /relation-tuples/check IS correct, and I just needed to use the newer docker container (0.10.0).

To avoid confusion, we may want to update the quickstart tutorial for keto.

The other big point of confusion is that there is no way to configure the host / base URL for the ruby gem. It pulls the server info from this method that has a hardcoded reference to the ory hosted infra.

image

Ideally, we would do something like this to allow it to point to local docker containers or other domains.

image

Wdyt?

EvanDaley commented 1 year ago

How is the ruby client built? Are we able to change one line like that? Is the gem auto-generated by some OpenAPI library?

jonas-jonas commented 1 year ago

How is the ruby client built?

To answer this question, all language SDKs are generated from our Open API schemas (which are generated from the source code) and committed/published as is. We don't have a process in place for changing parts of the SDK (yet) individually.

seuros commented 11 months ago
OryClient.configure do |config|  
config.server_index = nil
end 

should fix this issue.