Skip to main content

FAIRtracks JSON 验证器

项目描述

FAIRification Genomic Data Tracks JSON Schema 验证,Python 版

JSON 模式应符合 JSON Schema Draft04、Draft06 或 Draft07 规范。

因此,此验证程序使用符合该规范的库。

安装说明在INSTALL.md中。

历史

此代码的根源来自https://github.com/inab/benchmarking-data-model/tree/0.4.0/toolsForValidation

它的开发后来在 [https://github.com/fairtracks/fairtracks_validator/] 进行,其中还托管了其他编程语言的实现。Python 代码在那里获得了吸引力和真正的模块化。

由于此 Python 代码与多个研究项目相关,因此已从其最新的 repo 中分离出来,将核心和原始扩展保留在https://github.com/inab/python-extended-json-schema-validator并保留这些https://github.com/fairtracks/fairtracks_validator_python上的特定 FAIRTracks 扩展。

用法

python fairGTrackJsonValidate.py --help
usage: fairGTrackJsonValidate.py [-h] [--log-file LOGFILENAME] [--log-format LOGFORMAT] [-q] [-v] [-d] [-V] [-C CONFIGFILENAME]
                                 [--cache-dir CACHEDIR] [--report REPORTFILENAME] [--verbose-report]
                                 [--invalidate | --read-only] [--warm-up | --lazy-load]
                                 json_schema_or_dir [json_file_or_dir [json_file_or_dir ...]]

Validate JSON against JSON Schemas with extensions (version 0.9.7)

positional arguments:
  json_schema_or_dir    The JSON Schema file or directory to validate and use
  json_file_or_dir      The JSON files or directories to be validated

optional arguments:
  -h, --help            show this help message and exit
  --log-file LOGFILENAME
                        Store messages in a file instead of using standard error and standard output
  --log-format LOGFORMAT
                        Format of log messages
  -q, --quiet           Only show engine warnings and errors
  -v, --verbose         Show verbose (informational) messages
  -d, --debug           Show debug messages (use with care, as it could potentially disclose sensitive contents)
  -V, --version         show program's version number and exit
  -C CONFIGFILENAME, --config CONFIGFILENAME
                        Configuration file (used by extensions)
  --cache-dir CACHEDIR  Caching directory (used by extensions)
  --report REPORTFILENAME
                        Store validation report (in JSON format) in a file
  --verbose-report      When this flag is enabled, the report also embeds the json contents which were validated
  --invalidate          Caches are invalidated on startup
  --read-only           When this flag is enabled, the caches are read-only, avoiding expensive operations related to the caches
  --warm-up             Caches are warmed up on startup
  --lazy-load           Caches are warmed up in a lazy way

下一行使用测试数据运行验证:

git clone https://github.com/fairtracks/fairtracks_validator/
python fairGTrackJsonValidate.py fairtracks_validator/test-data/foreignProperty_simple/schemas/ fairtracks_validator/test-data/foreignProperty_simple/good_validation/
python fairGTrackJsonValidate.py fairtracks_validator/test-data/foreignProperty_simple/schemas/ fairtracks_validator/test-data/foreignProperty_simple/bad_validation/

这是一个记录 FAIRTracks Validator 以前版本的 asciinema:

asciiccast

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

fairtracks_validator-0.9.10.tar.gz (27.8 kB 查看哈希

已上传 source

内置分布

fairtracks_validator-0.9.10-py3-none-any.whl (30.3 kB 查看哈希

已上传 py3