Closed aeneasr closed 2 years ago
@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:
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:
** (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?
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.
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 😄
I think we could get those changes merged upstream in OpenAPI Generator quite swiftly, especially since publishing currently doesn't work without workarounds!
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
Awesome, thank you!
Related Issue or Design Document
Checklist
Further comments