Skip to content

Elixir#189

Merged
aeneasr merged 26 commits into
masterfrom
elixir
May 27, 2022
Merged

Elixir#189
aeneasr merged 26 commits into
masterfrom
elixir

Conversation

@aeneasr

@aeneasr aeneasr commented May 27, 2022

Copy link
Copy Markdown
Member

Related Issue or Design Document

Checklist

  • I have read the contributing guidelines
    and signed the CLA.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got green light (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added necessary documentation within the code base (if
    appropriate).

Further comments

@aeneasr

aeneasr commented May 27, 2022

Copy link
Copy Markdown
Member Author

@tobbbles

So I was able to get this almost working. But it's not working yet, I need your help here. Here is what I did:

  1. check out this branch
  2. Run:
docker build --platform linux/amd64 -t oryd/sdk:latest .
docker run --platform linux/amd64 --mount type=bind,source="$(pwd)",target=/project -it oryd/sdk:latest /bin/sh

export FORCE_VERSION=v1.11.0
export FORCE_PROJECT=hydra
cd /project

./scripts/generate.sh
./scripts/test.sh

cd clients/hydra/elixir

mix local.rebar --force
mix local.hex --force
mix deps.get


export HEX_API_KEY=THISDOESNOTMATTERYET
mix hex.publish --yes --dry-run

This will then fail due to multiple reasons. One of them of course is that the api key is wrong. But the problem is that it wants to build some docs, which do not seem to be included:

warning: found quoted atom "userinfo_signing_alg_values_supported" but the quotes are not required. Atoms made exclusively of ASCII letters, numbers, underscores, and optionally ending with ! or ? do not require quotes
  lib/ory/model/well_known.ex:68:5

Generated ory_hydra app
Publication failed because the "docs" task is unavailable. You may resolve this by:

  1. Adding {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} to your dependencies in your mix.exs and trying again
  2. If ex_doc was already added, make sure you run "mix hex.publish" in the same environment as the ex_doc package
  3. Publishing the package without docs by running "mix hex.publish package" (not recommended)

** (Mix) The task "docs" could not be found. Did you mean "do"?

For now, I worked around this with: mix hex.publish package but it says it's not recommended. How can we fix the docs task?

@aeneasr aeneasr merged commit 97372e5 into master May 27, 2022
@aeneasr aeneasr deleted the elixir branch May 27, 2022 09:03
@aeneasr aeneasr mentioned this pull request May 27, 2022
13 tasks
@tobbbles

Copy link
Copy Markdown
Contributor

Nice!

Hmm that's an interesting one, likely it's an issue with the upstream open api generator missing this package; I'll investigate a little deeper when I get to a machine.

@tobbbles

Copy link
Copy Markdown
Contributor

So, unfortunately it doesn't look like there's a trivial way to add extra dependencies to the generated Elixir projects without ripping open the openapi-generator source 😞

I'm thinking either
A) We provide a custom mix.exs.mustache file to enable finer control over the package details, such as adding extra dependencies, but also further things like licenses, links, source urls, etc. https://hex.pm/docs/publish#adding-metadata-to-code-classinlinemixexscode
B) We script adding the ex_doc dependency to mix.ex as a post-generation step.

A is more desirable but will require more maintenance, as we don't get upstream changes to the mix.exs template; however it looks like it gets about 4 commits per year 😄

@aeneasr

aeneasr commented May 27, 2022

Copy link
Copy Markdown
Member Author

I think we could get those changes merged upstream in OpenAPI Generator quite swiftly, especially since publishing currently doesn't work without workarounds!

@tobbbles

Copy link
Copy Markdown
Contributor

Opened an upstream issue to track this and gather input on one of two proposed solutions; let's see if we get any feedback, if not then we could make an assumption and look to go with the simpler change, or just 'brute force' including the ex_doc dependency in openapi-generator templates

@aeneasr

aeneasr commented May 27, 2022

Copy link
Copy Markdown
Member Author

Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants