fix(plugin): use binary `NameVsn` to re-build plugin avsc serde

This commit is contained in:
JimMoen 2024-05-08 14:18:28 +08:00
parent 68c601ad72
commit 25be9c2890
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -157,7 +157,7 @@ get_plugin_avscs() ->
lists:foldl( lists:foldl(
fun(AvscPath, AccIn) -> fun(AvscPath, AccIn) ->
[_, NameVsn | _] = lists:reverse(filename:split(AvscPath)), [_, NameVsn | _] = lists:reverse(filename:split(AvscPath)),
[{NameVsn, AvscPath} | AccIn] [{to_bin(NameVsn), AvscPath} | AccIn]
end, end,
_Acc0 = [], _Acc0 = [],
filelib:wildcard(Pattern) filelib:wildcard(Pattern)
@ -186,6 +186,8 @@ do_build_serde({NameVsn, AvscPath}) ->
{error, Error} {error, Error}
end. end.
make_serde(NameVsn, AvscPath) when not is_binary(NameVsn) ->
make_serde(to_bin(NameVsn), AvscPath);
make_serde(NameVsn, AvscPath) -> make_serde(NameVsn, AvscPath) ->
{ok, AvscBin} = read_avsc_file(AvscPath), {ok, AvscBin} = read_avsc_file(AvscPath),
Store0 = avro_schema_store:new([map]), Store0 = avro_schema_store:new([map]),