conform icon indicating copy to clipboard operation
conform copied to clipboard

Schema not found message with multiple level schema extends

Open aaronrenner opened this issue 7 years ago • 2 comments

I have an umbrella app with the following apps

myapp1
models
utils
otherapp

myapp1 has a conform dependency tree like this: myapp1 -> models -> utils. When I try to start the app in my distillery release (./bin/myapp1 start), I get the following output:

Schema extends utils, but the schema for utils was not found.
==> Generated sys.config in /Users/aaronrenner/projects/myapp/_build/prod/myapp1/var

The app starts up just fine and the settings that are defined in utils.schema.exs are properly mapped to var/sys.config, but I get this error message. As a side note, I knew it could find the utils.schema.exs at some point because it inserted utils' settings into apps/myapp/config/myapp.conf when I ran MIX_ENV=prod mix conform.configure. As part of my troubleshooting, I switched to the release directory and ran the following command:

unzip -l releases/0.0.1/myapp.schema.ez
    Length      Date    Time    Name
---------  ---------- -----   ----
     4807  08-02-2017 11:19   otherapp/config/otherapp.schema.exs
     4106  08-02-2017 11:19   myapp1/config/myapp1.schema.exs
     3912  08-02-2017 11:19   models/config/models.schema.exs
     2799  08-02-2017 11:19   utils/config/utils.schema.exs
---------                     -------
    26976                     4 files

I saw the utils schema file was in the .ez file and also found it interesting that otherapp's schema was also in the ez file (even though it's not a dependecy of myapp1).

I also ran 1 more experiment and removed all extends from my schemas and started my app and found the settings defined in utils.schema.exs were still properly mapped through to sys.config.

It seems like there might be a few issues here:

  1. The schema not found message starting an app that has multiple levels of extended schemas.
  2. Settings from <release_name>schema.exs are getting mapped through to sys.config even if the current app's schema doesn't extend them. (However I tried setting a config value for "otherapp" and that didn't get mapped through.)
  3. It seems weird that all of my umbrella apps schema files are included in the <release_name>.schema.ez instead of just the ones my app extends.

Please let me know if I've misconfigured something or missed something in the docs. Thanks!


Also, here are my example schema files if they're helpful.

apps/myapp1/config/myapp1.schema.exs

[
  extends: [:models],
  import: [],
  mappings: [
   #...
  ],
  transforms: []
]

apps/models/config/models.schema.exs

[
  extends: [:utils],
  import: [],
  mappings: [
   #...
  ],
  transforms: []
]

apps/utils/config/utils.schema.exs

[
  extends: [],
  import: [],
  mappings: [
   #...
  ],
  transforms: []
]

aaronrenner avatar Aug 02 '17 18:08 aaronrenner

I just ran into this issue on a separate project. Is there a way we can have multiple levels of extends in the schemas?

aaronrenner avatar Nov 27 '17 21:11 aaronrenner

Just bumping this issue. I have a couple umbrella apps which have 3-4 OTP releases apiece, and conform not being able to extend a tree of configs means I have to manually go through and figure out all of the app dependencies of each release and extend them in the released app's <app_name>.schema.exs. Conform is awesome, so it's worth this pain I'm facing, but if a fix isn't too hard, I'd really appreciate it.

aaronrenner avatar Apr 09 '18 19:04 aaronrenner