projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f070b55
)
Render better errors for ENUM validation
author
Egor Kislitsyn
<egor@kislitsyn.com>
Mon, 4 May 2020 18:33:34 +0000
(22:33 +0400)
committer
Egor Kislitsyn
<egor@kislitsyn.com>
Mon, 4 May 2020 18:33:34 +0000
(22:33 +0400)
lib/pleroma/web/api_spec/render_error.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/web/api_spec/render_error.ex
b/lib/pleroma/web/api_spec/render_error.ex
index b5877ca9c3b70a540be5d765eb13b5ec634648b1..d476b8ef3a237b889031e401c60d22969e057b3c 100644
(file)
--- a/
lib/pleroma/web/api_spec/render_error.ex
+++ b/
lib/pleroma/web/api_spec/render_error.ex
@@
-17,6
+17,9
@@
defmodule Pleroma.Web.ApiSpec.RenderError do
def call(conn, errors) do
errors =
Enum.map(errors, fn
+ %{name: nil, reason: :invalid_enum} = err ->
+ %OpenApiSpex.Cast.Error{err | name: err.value}
+
%{name: nil} = err ->
%OpenApiSpex.Cast.Error{err | name: List.last(err.path)}