为什么使用 onyx 的棱柱模式验证失败(ExceptionInfo 值与模式不匹配)?
Why does the validation fail (ExceptionInfo Value does not match schema) for a prismatic schema using onyx?
有人可以解释一下这里发生了什么吗?我已经仔细检查 dynamodb-local behavior using a non-onyxian client and simple operations work using Faraday . The code which I am trying to run is here and I have logged an issue here 但没有得到任何回复。
REPL 的输出如下:
$ lein repl
WARNING: cat already refers to: #'clojure.core/cat in namespace: clj-uuid.bitmop, being replaced by: #'clojure.core.reducers/cat
nREPL server started on port 44195 on host 127.0.0.1 - nrepl://127.0.0.1:44195
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.7.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b18
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
cqrs-server.core=> (start)
ExceptionInfo Value does not match schema: {:onyx/consumption missing-required-key, :onyx/batch-size missing-required-key, :onyx/medium missing-required-key} schema.core/validate (core.clj:161)
cqrs-server.core=>
使用 *e
的完整堆栈跟踪如下:-
cqrs-server.core=> *e
#error {
:cause "Value does not match schema: {:onyx/consumption missing-required-key, :onyx/batch-size missing-
required-key, :onyx/medium missing-required-key}"
:data {:type :schema.core/error, :schema (conditional #object[onyx.validation$fn__16409 0x6ba7a7e4 "ony
x.validation$fn__16409@6ba7a7e4"] {:onyx/name Keyword, :onyx/type (enum :output :function :input), :onyx
/consumption (enum :concurrent :sequential), :onyx/batch-size (pred pos?), Keyword Any, :onyx/medium Key
word} #object[clojure.core$constantly$fn__4383 0x5a6f89f1 "clojure.core$constantly$fn__4383@5a6f89f1"] {
:onyx/name Keyword, :onyx/type (enum :output :function :input), :onyx/consumption (enum :concurrent :seq
uential), :onyx/batch-size (pred pos?), Keyword Any, :onyx/fn Keyword}), :value {:onyx/name :event/aggre
gate-out, :onyx/type :output}, :error {:onyx/consumption missing-required-key, :onyx/batch-size missing-
required-key, :onyx/medium missing-required-key}}
:via
[{:type clojure.lang.ExceptionInfo
:message "Value does not match schema: {:onyx/consumption missing-required-key, :onyx/batch-size miss
ing-required-key, :onyx/medium missing-required-key}"
:data {:type :schema.core/error, :schema (conditional #object[onyx.validation$fn__16409 0x6ba7a7e4 "o
nyx.validation$fn__16409@6ba7a7e4"] {:onyx/name Keyword, :onyx/type (enum :output :function :input), :on
yx/consumption (enum :concurrent :sequential), :onyx/batch-size (pred pos?), Keyword Any, :onyx/medium K
eyword} #object[clojure.core$constantly$fn__4383 0x5a6f89f1 "clojure.core$constantly$fn__4383@5a6f89f1"]
{:onyx/name Keyword, :onyx/type (enum :output :function :input), :onyx/consumption (enum :concurrent :s
equential), :onyx/batch-size (pred pos?), Keyword Any, :onyx/fn Keyword}), :value {:onyx/name :event/agg
regate-out, :onyx/type :output}, :error {:onyx/consumption missing-required-key, :onyx/batch-size missin
g-required-key, :onyx/medium missing-required-key}}
:at [schema.core$validate invoke "core.clj" 161]}]
:trace
[[schema.core$validate invoke "core.clj" 161]
[onyx.validation$validate_catalog invoke "validation.clj" 48]
[onyx.validation$validate_job invoke "validation.clj" 122]
[onyx.api$submit_job invoke "api.clj" 90]
[cqrs_server.core$start invoke "core.clj" 207]
[cqrs_server.core$eval19231 invoke "form-init17061160983479843.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 6782]
[clojure.lang.Compiler eval "Compiler.java" 6745]
[clojure.core$eval invoke "core.clj" 3081]
[clojure.main$repl$read_eval_print__7099$fn__7102 invoke "main.clj" 240]
[clojure.main$repl$read_eval_print__7099 invoke "main.clj" 240]
[clojure.main$repl$fn__7108 invoke "main.clj" 258]
[clojure.main$repl doInvoke "main.clj" 258]
[clojure.lang.RestFn invoke "RestFn.java" 1523]
[clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__18624 invoke "interruptible_eval.clj"
87]
[clojure.lang.AFn applyToHelper "AFn.java" 152]
[clojure.lang.AFn applyTo "AFn.java" 144]
[clojure.core$apply invoke "core.clj" 630]
[clojure.core$with_bindings_STAR_ doInvoke "core.clj" 1868]
[clojure.lang.RestFn invoke "RestFn.java" 425]
[clojure.tools.nrepl.middleware.interruptible_eval$evaluate invoke "interruptible_eval.clj" 85]
[clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__18669$fn__18672 invoke "inte
rruptible_eval.clj" 222]
[clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__18664 invoke "interruptible_eval.clj"
190]
[clojure.lang.AFn run "AFn.java" 22]
[java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1142]
[java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 617]
[java.lang.Thread run "Thread.java" 745]]}
cqrs-server.core=>
cqrs-server.core=>
Faraday 客户端 REPL(my-ns
是用于测试的本地命名空间)的输出将连接到本地相同的 dynamodb 运行 如下:
my-ns=> (far/list-tables client-opts)
(:events)
my-ns=> (far/describe-table client-opts :events)
{:lsindexes nil, :gsindexes [{:name :event-idx, :size 0, :item-count 0, :key-schema [{:name :type, :type :hash} {:name :date, :type :range}], :projection {:projection-type "ALL", :non-key-attributes nil}, :throughput {:read 1, :write 1, :last-decrease nil, :last-increase nil, :num-decreases-today nil}}], :name :events, :throughput {:read 1, :write 1, :last-decrease #inst "1970-01-01T00:00:00.000-00:00", :last-increase #inst "1970-01-01T00:00:00.000-00:00", :num-decreases-today 0}, :prim-keys {:id {:key-type :hash, :data-type :s}, :date {:key-type :range, :data-type :n}, :type {:data-type :s}}, :size 0, :status :active, :item-count 0, :creation-date #inst "2016-03-10T22:53:33.601-00:00", :indexes nil}
my-ns=>
my-ns=> (far/scan client-opts :events)
[]
我已经为 core.clj
here and for cqrs.clj
here 创建了一个 public 要点以供审核。
我的 project.clj
看起来像 this.
有人可以帮我解决这个问题吗?
TIA
根据您提供的信息和我们的聊天,直接回答您的问题是配置中 :catalog
向量中的最后一个条目缺少密钥,如模式验证错误所示:
{:onyx/consumption missing-required-key, :onyx/batch-size missing-required-key, :onyx/medium missing-required-key}
有问题的条目(向量中的最后一个)是:
{:onyx/name :event/aggregate-out, :onyx/type :output}
并且您需要修复它以包含那些丢失的键:
{:onyx/name :event/aggregate-out,
:onyx/type :output,
:onyx/consumption <some value here>,
:onyx/batch-size <some value here>,
:onyx/medium <some value here>}
但总的来说,我会重新考虑您的一般方法。您想要实现什么目标?
在我看来,基于 "randomly" 选定的旧提交(似乎包含处于损坏状态的代码)来努力构建框架是不值得的。如果您在 cqrs-server 中发现错误,您将如何支持您的应用程序?您会从该自定义提交开始自己分叉并支持它吗?
我宁愿从您对问题的要求开始,然后使用更可靠和更好支持的解决方案来评估解决方案 library/framework 这样您就有更好的机会支持您的项目。
有人可以解释一下这里发生了什么吗?我已经仔细检查 dynamodb-local behavior using a non-onyxian client and simple operations work using Faraday . The code which I am trying to run is here and I have logged an issue here 但没有得到任何回复。
REPL 的输出如下:
$ lein repl
WARNING: cat already refers to: #'clojure.core/cat in namespace: clj-uuid.bitmop, being replaced by: #'clojure.core.reducers/cat
nREPL server started on port 44195 on host 127.0.0.1 - nrepl://127.0.0.1:44195
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.7.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b18
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
cqrs-server.core=> (start)
ExceptionInfo Value does not match schema: {:onyx/consumption missing-required-key, :onyx/batch-size missing-required-key, :onyx/medium missing-required-key} schema.core/validate (core.clj:161)
cqrs-server.core=>
使用 *e
的完整堆栈跟踪如下:-
cqrs-server.core=> *e
#error {
:cause "Value does not match schema: {:onyx/consumption missing-required-key, :onyx/batch-size missing-
required-key, :onyx/medium missing-required-key}"
:data {:type :schema.core/error, :schema (conditional #object[onyx.validation$fn__16409 0x6ba7a7e4 "ony
x.validation$fn__16409@6ba7a7e4"] {:onyx/name Keyword, :onyx/type (enum :output :function :input), :onyx
/consumption (enum :concurrent :sequential), :onyx/batch-size (pred pos?), Keyword Any, :onyx/medium Key
word} #object[clojure.core$constantly$fn__4383 0x5a6f89f1 "clojure.core$constantly$fn__4383@5a6f89f1"] {
:onyx/name Keyword, :onyx/type (enum :output :function :input), :onyx/consumption (enum :concurrent :seq
uential), :onyx/batch-size (pred pos?), Keyword Any, :onyx/fn Keyword}), :value {:onyx/name :event/aggre
gate-out, :onyx/type :output}, :error {:onyx/consumption missing-required-key, :onyx/batch-size missing-
required-key, :onyx/medium missing-required-key}}
:via
[{:type clojure.lang.ExceptionInfo
:message "Value does not match schema: {:onyx/consumption missing-required-key, :onyx/batch-size miss
ing-required-key, :onyx/medium missing-required-key}"
:data {:type :schema.core/error, :schema (conditional #object[onyx.validation$fn__16409 0x6ba7a7e4 "o
nyx.validation$fn__16409@6ba7a7e4"] {:onyx/name Keyword, :onyx/type (enum :output :function :input), :on
yx/consumption (enum :concurrent :sequential), :onyx/batch-size (pred pos?), Keyword Any, :onyx/medium K
eyword} #object[clojure.core$constantly$fn__4383 0x5a6f89f1 "clojure.core$constantly$fn__4383@5a6f89f1"]
{:onyx/name Keyword, :onyx/type (enum :output :function :input), :onyx/consumption (enum :concurrent :s
equential), :onyx/batch-size (pred pos?), Keyword Any, :onyx/fn Keyword}), :value {:onyx/name :event/agg
regate-out, :onyx/type :output}, :error {:onyx/consumption missing-required-key, :onyx/batch-size missin
g-required-key, :onyx/medium missing-required-key}}
:at [schema.core$validate invoke "core.clj" 161]}]
:trace
[[schema.core$validate invoke "core.clj" 161]
[onyx.validation$validate_catalog invoke "validation.clj" 48]
[onyx.validation$validate_job invoke "validation.clj" 122]
[onyx.api$submit_job invoke "api.clj" 90]
[cqrs_server.core$start invoke "core.clj" 207]
[cqrs_server.core$eval19231 invoke "form-init17061160983479843.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 6782]
[clojure.lang.Compiler eval "Compiler.java" 6745]
[clojure.core$eval invoke "core.clj" 3081]
[clojure.main$repl$read_eval_print__7099$fn__7102 invoke "main.clj" 240]
[clojure.main$repl$read_eval_print__7099 invoke "main.clj" 240]
[clojure.main$repl$fn__7108 invoke "main.clj" 258]
[clojure.main$repl doInvoke "main.clj" 258]
[clojure.lang.RestFn invoke "RestFn.java" 1523]
[clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__18624 invoke "interruptible_eval.clj"
87]
[clojure.lang.AFn applyToHelper "AFn.java" 152]
[clojure.lang.AFn applyTo "AFn.java" 144]
[clojure.core$apply invoke "core.clj" 630]
[clojure.core$with_bindings_STAR_ doInvoke "core.clj" 1868]
[clojure.lang.RestFn invoke "RestFn.java" 425]
[clojure.tools.nrepl.middleware.interruptible_eval$evaluate invoke "interruptible_eval.clj" 85]
[clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__18669$fn__18672 invoke "inte
rruptible_eval.clj" 222]
[clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__18664 invoke "interruptible_eval.clj"
190]
[clojure.lang.AFn run "AFn.java" 22]
[java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1142]
[java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 617]
[java.lang.Thread run "Thread.java" 745]]}
cqrs-server.core=>
cqrs-server.core=>
Faraday 客户端 REPL(my-ns
是用于测试的本地命名空间)的输出将连接到本地相同的 dynamodb 运行 如下:
my-ns=> (far/list-tables client-opts)
(:events)
my-ns=> (far/describe-table client-opts :events)
{:lsindexes nil, :gsindexes [{:name :event-idx, :size 0, :item-count 0, :key-schema [{:name :type, :type :hash} {:name :date, :type :range}], :projection {:projection-type "ALL", :non-key-attributes nil}, :throughput {:read 1, :write 1, :last-decrease nil, :last-increase nil, :num-decreases-today nil}}], :name :events, :throughput {:read 1, :write 1, :last-decrease #inst "1970-01-01T00:00:00.000-00:00", :last-increase #inst "1970-01-01T00:00:00.000-00:00", :num-decreases-today 0}, :prim-keys {:id {:key-type :hash, :data-type :s}, :date {:key-type :range, :data-type :n}, :type {:data-type :s}}, :size 0, :status :active, :item-count 0, :creation-date #inst "2016-03-10T22:53:33.601-00:00", :indexes nil}
my-ns=>
my-ns=> (far/scan client-opts :events)
[]
我已经为 core.clj
here and for cqrs.clj
here 创建了一个 public 要点以供审核。
我的 project.clj
看起来像 this.
有人可以帮我解决这个问题吗?
TIA
根据您提供的信息和我们的聊天,直接回答您的问题是配置中 :catalog
向量中的最后一个条目缺少密钥,如模式验证错误所示:
{:onyx/consumption missing-required-key, :onyx/batch-size missing-required-key, :onyx/medium missing-required-key}
有问题的条目(向量中的最后一个)是:
{:onyx/name :event/aggregate-out, :onyx/type :output}
并且您需要修复它以包含那些丢失的键:
{:onyx/name :event/aggregate-out,
:onyx/type :output,
:onyx/consumption <some value here>,
:onyx/batch-size <some value here>,
:onyx/medium <some value here>}
但总的来说,我会重新考虑您的一般方法。您想要实现什么目标?
在我看来,基于 "randomly" 选定的旧提交(似乎包含处于损坏状态的代码)来努力构建框架是不值得的。如果您在 cqrs-server 中发现错误,您将如何支持您的应用程序?您会从该自定义提交开始自己分叉并支持它吗?
我宁愿从您对问题的要求开始,然后使用更可靠和更好支持的解决方案来评估解决方案 library/framework 这样您就有更好的机会支持您的项目。