ory / sdk

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

Elixir API client deserialisation error when parsing enum values #355

Open tomwilsonsb opened 1 month ago

tomwilsonsb commented 1 month ago

Preflight checklist

Ory Network Project

No response

Describe the bug

The elixir client has some issues when parsing response data that contains "enums"

Reproducing the bug

E.g. when calling: Ory.Api.Frontend.to_session(Ory.Connection.new, [Cookie: cookie])

I get the following error:


    The following arguments were given to Ory.Deserializer.to_struct/2:

        # 1
        "aal1"

        # 2
        Ory.Model.AuthenticatorAssuranceLevel

    Attempted function clauses (showing 3 out of 3):

        defp to_struct(nil, _)
        defp to_struct(list, module) when is_list(list) and is_atom(module)
        defp to_struct(map, module) when is_map(map) and is_atom(module)

    (ory_client 1.6.2) lib/ory/deserializer.ex:97: Ory.Deserializer.to_struct/2
    (elixir 1.15.7) lib/map.ex:916: Map.update!/3
    (ory_client 1.6.2) lib/ory/model/session_authentication_method.ex:31: Ory.Model.SessionAuthenticationMethod.decode/1
    (elixir 1.15.7) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
    (elixir 1.15.7) lib/map.ex:916: Map.update!/3
    (ory_client 1.6.2) lib/ory/model/session.ex:42: Ory.Model.Session.decode/1
    (ory_client 1.6.2) lib/ory/deserializer.ex:19: Ory.Deserializer.jason_decode/2
    iex:2: (file)

It is potentially caused by this bug I found on the open-api-generator GitHub: https://github.com/OpenAPITools/openapi-generator/issues/16412

Relevant log output

No response

Relevant configuration

No response

Version

1.6

On which operating system are you observing this issue?

None

In which environment are you deploying?

None

Additional Context

No response

binajmen commented 1 week ago

@aeneasr Apologies for the ping, but is this bug being tracked? I want to integrate Ory into our Elixir API server, but the Ory client isn't usable in its current state.

aeneasr commented 2 days ago

I believe this should be fixed now