-
Notifications
You must be signed in to change notification settings - Fork 32
Description
This tutorial needs to be updated so that it compiles, and preferentially without warnings about depricated means being used in the actual tutorial.
I am more than willing to try to nudge this into the right direction by using elbow grease, but I don't yet have the brains to do so - so if I could tap into someone else's, that might get things going in the right direction.
Having smooth running first tutorial(s) might actually be the ramping needed to get the footfall going upwards.
These tutorials could also serve two purposes at the same time, introduce newbies ( like me) to this great ecosystem, AND at the same time provide a readymade testbed for test cases supporting the difficult task of replicating real issues people are running into.
Companies often can't share the source code for replicating issues, it is private, business/legally sensitive and it can often be hard to pull out a meaningful test case from a large complex system.
Having a really smooth tutorial, that doubles as a test bed for replicating test cases means that these tutorials get improved importance and will be nurtured and maintained better as they suddenly make sense to both the newbies and the veterans, though serving two different purpose or role at the same time.
Anyway, enough of ranting... :-)
I tried to go through this tutorial, and this is what I got.
====
$ git clone https://github.com/absinthe-graphql/absinthe_tutorial.git
Cloning into 'absinthe_tutorial'...
remote: Enumerating objects: 357, done.
remote: Total 357 (delta 0), reused 0 (delta 0), pack-reused 357
Receiving objects: 100% (357/357), 108.11 KiB | 595.00 KiB/s, done.
Resolving deltas: 100% (140/140), done.
- And then what?
The README.md does not give any hints regarding what the next step should be
for following the tutorial.
The docs are in *.md format, shouldn't they be in html or even just plain txt format?
And where are the documents?
Tried the following from the absinthe_tutorial/ root:
$ find . -name "*.md"
./LICENSE.md
./README.md
$ find . -name "*.txt"
gives nothing
find . -name "*.html"
gives nothing
The README.md gives https://hexdocs.pm/absinthe/ which is redirected to
https://hexdocs.pm/absinthe/overview.html which is fine.
But what if the docs at https://hexdocs.pm/absinthe/overview.html are updated?
Then the version I have checked out might be out of sync with the version online
at https://hexdocs.pm/absinthe/overview.html - not good.
For example if you are a company and are running certain version locally, and
referring to the docs https://hexdocs.pm/absinthe/overview.html you might be
suddenly running into trouble when those get updated, and then the help forums get overwhelmed with silly requests... which would be a totally uneccesary timewasting pitfall.
- Going ahead - without any hints coming from the actual tutorial material I just checked out (if I hadn't actually gone through material from a v. good book, I would have been lost at this stage...)
$ mix deps.get
warning: found quoted keyword "test" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of Unicode letters, numbers, underscore, and @ do not require quotes
mix.exs:61
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
absinthe 1.4.0
absinthe_ecto 0.1.3
absinthe_plug 1.4.0
argon2_elixir 1.2.9
comeonin 4.0.3
connection 1.0.4
cowboy 1.1.2
cowlib 1.0.2
db_connection 1.1.2
decimal 1.4.1
ecto 2.2.6
elixir_make 0.4.0
gettext 0.13.1
mime 1.1.0
phoenix 1.3.0
phoenix_ecto 3.3.0
phoenix_pubsub 1.0.2
plug 1.4.3
poison 3.1.0
poolboy 1.5.1
postgrex 0.13.3
ranch 1.3.2
* Getting phoenix (Hex package)
* Getting phoenix_pubsub (Hex package)
* Getting phoenix_ecto (Hex package)
* Getting ecto (Hex package)
* Getting postgrex (Hex package)
* Getting gettext (Hex package)
* Getting cowboy (Hex package)
* Getting absinthe (Hex package)
* Getting absinthe_plug (Hex package)
* Getting absinthe_ecto (Hex package)
* Getting comeonin (Hex package)
* Getting argon2_elixir (Hex package)
* Getting elixir_make (Hex package)
* Getting plug (Hex package)
* Getting mime (Hex package)
* Getting cowlib (Hex package)
* Getting ranch (Hex package)
* Getting connection (Hex package)
* Getting db_connection (Hex package)
* Getting decimal (Hex package)
* Getting poolboy (Hex package)
* Getting poison (Hex package)
This warning above about quoted keyword "test" should be fixed - for a newby it is scary...
it should be inviting and reassuring experience to run through a first tutorial like this.
- Muddling along...
$ mix ecto.setup
warning: found quoted keyword "test" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of Unicode letters, numbers, underscore, and @ do not require quotes
mix.exs:61
==> connection
Compiling 1 file (.ex)
Generated connection app
==> gettext
Compiling 1 file (.yrl)
Compiling 1 file (.erl)
Compiling 20 files (.ex)
warning: Enum.chunk/2 is deprecated. Use Enum.chunk_every/2 instead
lib/gettext/po/parser.ex:58
warning: Enum.partition/2 is deprecated. Use Enum.split_with/2 instead
Found at 3 locations:
lib/gettext/extractor_agent.ex:64
lib/gettext/po/parser.ex:44
lib/gettext/po/parser.ex:71
warning: String.lstrip/1 is deprecated. Use String.trim_leading/1 instead
lib/gettext/po/parser.ex:65
warning: String.strip/1 is deprecated. Use String.trim/1 instead
Found at 2 locations:
lib/gettext/po/parser.ex:47
lib/gettext/po/parser.ex:55
warning: String.to_char_list/1 is deprecated. Use String.to_charlist/1 instead
lib/gettext/po/tokenizer.ex:147
Generated gettext app
===> Compiling ranch
src/ranch_ssl.erl:128: Warning: ssl:ssl_accept/2: deprecated; use ssl:handshake/2 instead
==> poolboy (compile)
Compiled src/poolboy_worker.erl
Compiled src/poolboy_sup.erl
src/poolboy.erl:59: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
Compiled src/poolboy.erl
==> decimal
Compiling 1 file (.ex)
Generated decimal app
==> absinthe
Compiling 2 files (.erl)
/Users/ben/.asdf/installs/erlang/20.1/lib/erlang/lib/parsetools-2.1.5/include/yeccpre.hrl:60: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
Compiling 216 files (.ex)
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/absinthe/phase/document/validation/scalar_leafs.ex:69
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/absinthe/pipeline/batch_resolver.ex:97
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/absinthe/schema/rule/default_enum_value_present.ex:44
warning: calling super for GenServer callback handle_info/2 is deprecated
lib/absinthe/subscription/registry.ex:966
warning: unused alias Blueprint
lib/absinthe/type/built_ins/directives.ex:5
warning: function parse_boolean/1 is unused
lib/absinthe/type/built_ins/scalars.ex:107
warning: function parse_float/1 is unused
lib/absinthe/type/built_ins/scalars.ex:77
warning: function parse_date/1 is unused
lib/absinthe/type/custom.ex:105
warning: function parse_id/1 is unused
lib/absinthe/type/built_ins/scalars.ex:96
warning: function parse_datetime/1 is unused
lib/absinthe/type/custom.ex:74
warning: function parse_int/1 is unused
lib/absinthe/type/built_ins/scalars.ex:69
warning: function parse_naive_datetime/1 is unused
lib/absinthe/type/custom.ex:90
warning: function parse_string/1 is unused
lib/absinthe/type/built_ins/scalars.ex:88
warning: function parse_time/1 is unused
lib/absinthe/type/custom.ex:120
warning: function parse_with/2 is unused
lib/absinthe/type/built_ins/scalars.ex:115
Generated absinthe app
warning: String.strip/1 is deprecated. Use String.trim/1 instead
/Users/Friddev/dev/FloatingFront/elixir/absinthe_tutorial3/absinthe_tutorial/deps/poison/mix.exs:4
==> poison
Compiling 4 files (.ex)
warning: Integer.to_char_list/2 is deprecated. Use Integer.to_charlist/2 instead
lib/poison/encoder.ex:173
Generated poison app
==> elixir_make
Compiling 1 file (.ex)
Generated elixir_make app
==> argon2_elixir
mkdir -p priv
cc -std=c89 -pthread -O3 -Wall -g -Iargon2/include -Iargon2/src -Ic_src -I/opt/local/lib/erlang/erts-10.1/include -march=native -dynamiclib -undefined dynamic_lookup argon2/src/argon2.c argon2/src/core.c argon2/src/blake2/blake2b.c argon2/src/thread.c argon2/src/encoding.c c_src/argon2_nif.c argon2/src/opt.c -o priv/argon2_nif.so
Compiling 3 files (.ex)
Generated argon2_elixir app
==> comeonin
Compiling 2 files (.ex)
Generated comeonin app
==> db_connection
Compiling 23 files (.ex)
warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:
def text do
"""
contents
"""
end
Instead make sure the contents are indented as much as the heredoc closing:
def text do
"""
contents
"""
end
The current heredoc line is indented too little
lib/db_connection.ex:572
warning: function slice/1 required by protocol Enumerable is not implemented (in module Enumerable.DBConnection.Stream)
lib/db_connection.ex:9
warning: function slice/1 required by protocol Enumerable is not implemented (in module Enumerable.DBConnection.PrepareStream)
lib/db_connection.ex:25
Generated db_connection app
==> phoenix_pubsub
Compiling 12 files (.ex)
Generated phoenix_pubsub app
===> Compiling cowlib
src/cow_multipart.erl:392: Warning: call to crypto:rand_bytes/1 will fail, since it was removed in 20.0; use crypto:strong_rand_bytes/1
===> Compiling cowboy
src/cowboy_websocket.erl:147: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
src/cowboy_websocket.erl:645: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
src/cowboy_websocket.erl:755: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
src/cowboy_rest.erl:69: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
src/cowboy_rest.erl:1006: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
src/cowboy_handler.erl:87: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
src/cowboy_handler.erl:116: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
src/cowboy_handler.erl:235: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
src/cowboy_handler.erl:290: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
==> mime
Compiling 1 file (.ex)
warning: String.strip/1 is deprecated. Use String.trim/1 instead
lib/mime.ex:28
Generated mime app
==> plug
Compiling 1 file (.erl)
Compiling 44 files (.ex)
warning: calling super for GenServer callback handle_info/2 is deprecated
lib/plug/upload.ex:166
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/plug/error_handler.ex:82
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/plug/conn/wrapper_error.ex:21
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/plug/conn/wrapper_error.ex:26
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/plug/conn.ex:422
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/plug/conn.ex:446
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/plug/conn.ex:506
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/plug/conn.ex:1033
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/plug/conn.ex:1057
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/plug/conn.ex:1089
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/plug/conn.ex:1111
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/plug/debugger.ex:115
warning: Code.get_docs/2 is deprecated. Code.get_docs/2 always returns nil as its outdated documentation is no longer stored on BEAM files. Use Code.fetch_docs/1 instead
lib/plug/debugger.ex:288
warning: Enum.partition/2 is deprecated. Use Enum.split_with/2 instead
lib/plug/adapters/cowboy.ex:46
Generated plug app
==> absinthe_plug
Compiling 18 files (.ex)
warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:
def text do
"""
contents
"""
end
Instead make sure the contents are indented as much as the heredoc closing:
def text do
"""
contents
"""
end
The current heredoc line is indented too little
lib/absinthe/plug/document_provider/compiled.ex:45
warning: unused alias Blueprint
lib/absinthe/plug/types.ex:56
Generated absinthe_plug app
warning: found quoted keyword "docs" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of Unicode letters, numbers, underscore, and @ do not require quotes
/Users/Friddev/dev/FloatingFront/elixir/absinthe_tutorial3/absinthe_tutorial/deps/phoenix/mix.exs:138
==> phoenix
Compiling 74 files (.ex)
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/phoenix/router/helpers.ex:181
warning: invalid type annotation. When using the | operator to represent the union of types, make sure to wrap type annotations in parentheses: {:ok, pid()} | {:error, reason :: term()} :: :ignore
lib/phoenix/presence.ex:110
warning: function init/1 required by behaviour GenServer is not implemented (in module Phoenix.CodeReloader.Proxy).
We will inject a default implementation for now:
def init(init_arg) do
{:ok, init_arg}
end
You can copy the implementation above or define your own that converts the arguments given to GenServer.start_link/3 to the server state.
lib/phoenix/code_reloader/proxy.ex:3
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/phoenix/endpoint/render_errors.ex:51
warning: Enum.partition/2 is deprecated. Use Enum.split_with/2 instead
Found at 3 locations:
lib/mix/phoenix/schema.ex:235
lib/mix/tasks/phoenix.gen.model.ex:155
lib/phoenix/endpoint/handler.ex:39
Generated phoenix app
==> postgrex
Compiling 62 files (.ex)
warning: function slice/1 required by protocol Enumerable is not implemented (in module Enumerable.Postgrex.Stream)
lib/postgrex/stream.ex:22
warning: Enum.partition/2 is deprecated. Use Enum.split_with/2 instead
lib/postgrex/error_code.ex:14
Generated postgrex app
==> ecto
Compiling 70 files (.ex)
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/ecto/repo.ex:106
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/ecto/schema.ex:1854
warning: function slice/1 required by protocol Enumerable is not implemented (in module Enumerable.Ecto.Adapters.SQL.Stream)
lib/ecto/adapters/sql/stream.ex:12
warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions
lib/ecto/changeset.ex:1567
warning: function init/1 required by behaviour GenServer is not implemented (in module Ecto.Migration.Runner).
We will inject a default implementation for now:
def init(init_arg) do
{:ok, init_arg}
end
You can copy the implementation above or define your own that converts the arguments given to GenServer.start_link/3 to the server state.
lib/ecto/migration/runner.ex:1
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/ecto/query/planner.ex:1248
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/ecto/repo/preloader.ex:378
warning: Inspect.Algebra.surround_many/5 is deprecated. Use Inspect.Algebra.container_doc/6 instead
Found at 3 locations:
lib/ecto/changeset.ex:2396
lib/ecto/query/inspect.ex:15
lib/ecto/query/inspect.ex:29
Generated ecto app
==> absinthe_ecto
Compiling 1 file (.ex)
Generated absinthe_ecto app
==> phoenix_ecto
Compiling 6 files (.ex)
Generated phoenix_ecto app
==> blog
Compiling 21 files (.ex)
warning: unused alias Resolvers
lib/blog_web/schema/account_types.ex:4
== Compilation error in file lib/blog_web/schema.ex ==
** (Absinthe.Schema.Error) Invalid schema:
Elixir.BlogWeb.Schema:0: The root query type must be implemented and be a of type Object
#Example
defmodule MyApp.Schema do
use Absinthe.Schema
query do
#Fields go here
end
end
--------------------------------------
From the graqhql schema specifiation
A GraphQL schema includes types, indicating where query and mutation
operations start. This provides the initial entry points into the type system.
The query type must always be provided, and is an Object base type. The
mutation type is optional; if it is null, that means the system does not
support mutations. If it is provided, it must be an object base type.
Reference: https://facebook.github.io/graphql/#sec-Initial-types
lib/absinthe/schema.ex:294: Absinthe.Schema.__after_compile__/2
(stdlib) lists.erl:1263: :lists.foldl/3
(stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
(elixir) lib/kernel/parallel_compiler.ex:208: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6
Now this is not as it should be, lots of warnings about depricated stuff, and finally the
query used in the tutorial doesn't actually compile:
= Compilation error in file lib/blog_web/schema.ex ==
** (Absinthe.Schema.Error) Invalid schema:
Elixir.BlogWeb.Schema:0: The root query type must be implemented and be a of type Object
#Example
defmodule MyApp.Schema do
use Absinthe.Schema
query do
#Fields go here
end
end
--------------------------------------
From the graqhql schema specifiation
A GraphQL schema includes types, indicating where query and mutation
operations start. This provides the initial entry points into the type system.
The query type must always be provided, and is an Object base type. The
mutation type is optional; if it is null, that means the system does not
support mutations. If it is provided, it must be an object base type.
Reference: https://facebook.github.io/graphql/#sec-Initial-types
lib/absinthe/schema.ex:294: Absinthe.Schema.__after_compile__/2
(stdlib) lists.erl:1263: :lists.foldl/3
(stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
(elixir) lib/kernel/parallel_compiler.ex:208: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6
Everyone can see that this is not as it should be, I understand that there are more pressing issues than fixing tutorial material 101 for newbies - but it could be so much better and server twofold purpose in providing bug replicating testbed for test cases - then everyone would see benefit of having great tutorial material and the silly support issues would go down, and everyone be happy :-)