What do I have to put into mix.exs
to see/use the key :id
if calling:
Application.spec(:app, :id)
Tried to enter just id: "some text"
but no luck.
dbg( Application.spec(:app, :id))
output looks like it’s expecting a list:
Application.spec(:app, :id) #=> []
Link to spec/1:
https://hexdocs.pm/elixir/1.15.7/Application.html#spec/1
Is there a better documentation anywhere else?
Here is the specification: Erlang -- app
Can you please send a PR that adds the link above to the function documentation?
After further testing I think there is perhaps something wrong with Application.spec
I restarted the server with every change to mix.exs
opened 02:40PM - 28 Oct 23 UTC
### Elixir and Erlang/OTP versions
Erlang/OTP 26 [erts-14.1.1] [source] [64-bit… ] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]
Elixir 1.15.7 (compiled with Erlang/OTP 26)
### Operating system
Debian Linux
### Current behavior
The call `Application.spec(:backend, :id)` returns an empty list as shown by calling dbg():
```
Application.spec(:backend, :id) #=> []
```
Despite `mix.exs` contains the key:
```
id: "ID string",
description: "Description string",
```
Furthermore the call to `Application.spec(:backend, :description)` outputs the content of the :app key if the description key is missing:
```
Application.spec(:backend, :description) #=> ~c"backend"
```
### Expected behavior
`Application.spec(:backend, :id` and `Application.spec(:backend, :description` should either return the content of a existing key or an empty string
Was about to create a PR for the documentation but you were faster than me
1 Like
Was more or less me not reading the documentation and lacking knowledge. Thanks to @josevalim
The :id
key belongs to application
and has to be a character list
(not a string
):
def application do
[
id: 'FC94 1973 58',
[...]
]
Only :description
and :version
are copied over from project
to application
:
def project do
[
app: :app,
version: "version",
description: "description",
[...]
]
end
1 Like