Skip to content

Generated Elixir module names clash #229

Open
@paulbalomiri

Description

@paulbalomiri

Preflight checklist

Bug Description

Generated Elixir module names such as Ory.Connection clash. Elixir dependencies cannot override each other's Modules, but the generated code does contain the same module name in different dependencies:

Examples:

defmodule Ory.Connection do

defmodule Ory.Connection do

defmodule Ory.Connection do

defmodule Ory.Connection do

defmodule Ory.Connection do

defmodule Ory.Connection do

This is a follwup to this comment #194 (comment)

Reproducing the bug

Create any library importing e.g. at least 2 packages:
Example snippet from mix.exs:

defp deps do
    [
     ...
      {:ory_client, github: "ory/sdk", sparse: "clients/client/elixir/"},
      {:ory_hydra, github: "ory/sdk", sparse: "clients/hydra/elixir/"}
     ]
  end

Relevant log output

when building/running lots of warnings such as this one is logged:

warning: redefining module Ory.Connection (current version loaded from /workspace/cantex_umbrella/_build/dev/lib/ory_client/ebin/Elixir.Ory.Connection.beam)
  lib/ory/connection.ex:5

Relevant configuration

Here is the Variable setting, to which I propose to add this line:

export ELIXIR_INVOKER_MODULE="Ory.${PROJECT^}"

export ELIXIR_PACKAGE_NAME="ory_${PROJECT}"

And here the line 3 should be changed to

invokerPackage: ${ELIXIR_INVOKER_MODULE}

packageName: ${ELIXIR_PACKAGE_NAME}
packageVersion: $RAW_VERSION
invokerPackage: Ory

This results in package names such as Ory.Hydra.Connection

Version

latest stable versions

Additional Context

@aeneasr I'm putting here the questions I have for understanding & documentation, These are mostly issues to get the PR right.

  • How shall a PR be formulated? I'm thinking about a multi commit PR, one commit comprising the config changes, another one with each package.?
  • Does the build pipeline build all clients, all the time?
  • Are the old spec vertions built too?
  • How does the spec version map to package versions generally [if there's a rule/docs]?
  • Is there such a thing as an [aglorithmic] sdk version ?

I'll come back with a PR on this, I've already forked the sdk. The bug is easy to solve, but perhaps a followup documentation issue would benefit from those questions.

It's a rather long post, so feel free to only discuss in context of the upcoming PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions