diff --git a/lib/neo4ex/bolt_protocol/structure.ex b/lib/neo4ex/bolt_protocol/structure.ex index 7443266..ad55571 100644 --- a/lib/neo4ex/bolt_protocol/structure.ex +++ b/lib/neo4ex/bolt_protocol/structure.ex @@ -153,6 +153,11 @@ defmodule Neo4ex.BoltProtocol.Structure do # embedded structure must be a map but we should take advantage of field versioning defp embedded_encoder_protocol(fields_list) do + # When default values contain some data from module (like values from attributes) it won't be visible inside defimpl (different module) + # For protocol we need only version so this is completely fine + fields_list = + Enum.map(fields_list, fn {field, opts} -> {field, [version: opts[:version]]} end) + quote location: :keep do defimpl Neo4ex.BoltProtocol.Encoder do def encode(struct, bolt_version) do @@ -170,6 +175,11 @@ defmodule Neo4ex.BoltProtocol.Structure do end defp encoder_protocol(fields_list) do + # When default values contain some data from module (like values from attributes) it won't be visible inside defimpl (different module) + # For protocol we need only version so this is completely fine + fields_list = + Enum.map(fields_list, fn {field, opts} -> {field, [version: opts[:version]]} end) + quote location: :keep do defimpl Neo4ex.BoltProtocol.Encoder do alias Neo4ex.PackStream.{Markers, Exceptions} diff --git a/lib/neo4ex/bolt_protocol/structure/message/extra/hello.ex b/lib/neo4ex/bolt_protocol/structure/message/extra/hello.ex index 65cf2f8..36fb87a 100644 --- a/lib/neo4ex/bolt_protocol/structure/message/extra/hello.ex +++ b/lib/neo4ex/bolt_protocol/structure/message/extra/hello.ex @@ -2,7 +2,6 @@ defmodule Neo4ex.BoltProtocol.Structure.Message.Extra.Hello do use Neo4ex.BoltProtocol.Structure @version Mix.Project.config()[:version] - @system_info System.build_info()[:version] # can't be encoded directly, it's just helper for the Hello message embeded_structure do @@ -11,7 +10,7 @@ defmodule Neo4ex.BoltProtocol.Structure.Message.Extra.Hello do field(:bolt_agent, default: %{ product: "Neo4ex/#{@version}", - language: "Elixir/#{@system_info}" + language: "Elixir/#{System.build_info()[:version]}" }, version: ">= 5.3.0" )