@asymmetrik/fhir-json-schema-validator

中文文档
0.9.8发布于 2020/09/23MITCommonJS近 30 天下载 2.5万

FHIR json schema validator

原始使用文档
文档目录3 节
  1. Install
  2. Arguments
  3. Usage

FHIR-JSON-SCHEMA-VALIDATOR

Utility for validating FHIR resources

Install

yarn add @asymmetrik/fhir-json-schema-validator

Arguments

@asymmetrik/fhir-json-schema-validator exports a single class called JSONSchemaValidator. This class takes two optional arguments for initialization:

schema

This is the path to the JSON schema that you would like to validate against. It defaults to the fhir.schema.json file included in this package.

ajvSettings

This is an object with the settings to pass on to AJV. It defaults to suppresses log and warn messages, but logs error messages. For a full list of AJV options see the README on the AJV GitHub page athttps://github.com/epoberezkin/ajv.

// Default initialization:
let defaultValidator = new JSONSchemaValidator();

// Custom initialization
let defaultValidator = new JSONSchemaValidator(schema, ajvSettings);

Usage

The QueryBuilder class has a method called validate which takes two arguments:

resource

The resource that is to be validated against the FHIR JSON schema.

verbose

Boolean value specifying whether or not to return the full set of validation errors (true) or to take the time to condense error messages (false). Defaults to false. The error messages generated by the over-arching json schema are too numerous to be of any use. For any specific resource, we can compile a resource-specific validator and re-validate to get more concise and helpful error messages.

The validate method returns an array that contains any errors generated from validation. This list will be of length 0 if no errors were found.

See index.test.js for examples of usage

版本与发布记录

@asymmetrik/fhir-json-schema-validator 共发布 7 个版本,首次发布于 2019/05/16;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.9.8latest2020/09/236 年前
0.9.72020/09/146 年前
0.9.52019/10/047 年前
0.9.42019/09/267 年前
0.9.32019/09/097 年前
0.9.22019/05/237 年前

关于 @asymmetrik/fhir-json-schema-validator 的常见问题

@asymmetrik/fhir-json-schema-validator 是什么?

FHIR json schema validator

如何安装 @asymmetrik/fhir-json-schema-validator?

在项目目录运行 npm install @asymmetrik/fhir-json-schema-validator,或使用 pnpm add / yarn add / bun add。

@asymmetrik/fhir-json-schema-validator 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/asymmetrik__fhir-json-schema-validator 是否存在。

@asymmetrik/fhir-json-schema-validator 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@asymmetrik/fhir-json-schema-validator 可以商用吗?

@asymmetrik/fhir-json-schema-validator 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@asymmetrik/fhir-json-schema-validator 的下载量有多少?

根据 npm 官方下载统计,@asymmetrik/fhir-json-schema-validator 在 2026/10/07 – 2026/11/05 这 30 天内被下载 25,388 次,日均约 846 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@asymmetrik/fhir-json-schema-validator 还在维护吗?

最新版本 0.9.8 发布于 2020/09/23(6 年前);至今共发布 7 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/05/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。