是否可以从命令行运行 json-schema-validator?
有 json-schema-validator 的 jar 文件吗?我在以下位置找到了一个 jar :
[http://mvnrepository.com/artifact/com.github.fge/json-schema-validator/2.1.8][1]
但它似乎已损坏/不完整/某些东西(我不是 Java 程序员)。将 java.exe 应用到 jar 文件:
java -jar json-schema-validator-2.1.8.jar
导致此错误消息:
"no main manifest attribute, in json-schema-validator-2.1.8.jar"
这是什么意思?
这是我的问题:
哪里可以获取 json-schema-validator 的正确 jar 文件?
获取 jar 文件后,如何在命令行上使用它来根据 json-schema 文件验证 json 文件?也就是说,在命令行上我想输入如下内容:
java -jar json-schema-validator-2.1.8.jar instance.json schema.json
并让 validator 根据 schema.json 验证 instance.json 并在命令行上显示验证结果。
谢谢!
最佳答案
好的,从 2.1.10 版本开始,您实际上可以做到这一点。 the README of the project 中提供了说明。 。以下是当前版本的帮助:
$ java -Done-jar.silent=true -jar json-schema-validator-2.1.10-standalone.jar --help
Syntax: java -jar jsonschema.jar [options] file [file...]
Options:
-s, --brief: only show validation status (OK/NOT OK)
--help: show this help
-q, --quiet: no output; exit with the relevant return code (see below)
--syntax: check the syntax of schema(s) given as argument(s)
Exit codes:
0: validation successful;
1: exception occurred (appears on stderr)
2: command line syntax error (missing argument, etc)
100: one or more file(s) failed validation
101: one or more schema(s) is/are invalid
关于java - 如何从命令行运行 json-schema-validator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22867521/