From d357adb5c22c255ba5f049fbed9bf1ff568963ee Mon Sep 17 00:00:00 2001 From: shaselton-usds Date: Mon, 22 Apr 2024 13:15:44 -0700 Subject: [PATCH 1/2] minor refactor to remove the 'not' conditional language - will be easier to maintain in the future --- src/versions/2.0/json.ts | 9 ++++----- test/2.0/json.spec.ts | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/versions/2.0/json.ts b/src/versions/2.0/json.ts index 5475c92..8ca7d50 100644 --- a/src/versions/2.0/json.ts +++ b/src/versions/2.0/json.ts @@ -87,16 +87,15 @@ const STANDARD_CHARGE_DEFINITIONS = { properties: { payers_information: { type: "array", - items: { + contains: { type: "object", - not: { - required: ["standard_charge_dollar"], - }, + required: ["standard_charge_dollar"], }, }, }, + required: ["payers_information"], }, - else: { + then: { required: ["minimum", "maximum"], }, }, diff --git a/test/2.0/json.spec.ts b/test/2.0/json.spec.ts index a98d996..5cecd28 100644 --- a/test/2.0/json.spec.ts +++ b/test/2.0/json.spec.ts @@ -171,7 +171,7 @@ test("validateJsonConditionals", async (t) => { { path: "/standard_charge_information/1/standard_charges/0", field: "0", - message: 'must match "else" schema', + message: 'must match "then" schema', }, { path: "/standard_charge_information/2/standard_charges/0", @@ -181,7 +181,7 @@ test("validateJsonConditionals", async (t) => { { path: "/standard_charge_information/2/standard_charges/0", field: "0", - message: 'must match "else" schema', + message: 'must match "then" schema', }, { path: "/standard_charge_information/3/standard_charges/0", @@ -191,7 +191,7 @@ test("validateJsonConditionals", async (t) => { { path: "/standard_charge_information/3/standard_charges/0", field: "0", - message: 'must match "else" schema', + message: 'must match "then" schema', }, ]) }) From 23d1183d3940d0814a1cc51da73fe3d4c6949e37 Mon Sep 17 00:00:00 2001 From: shaselton-usds Date: Mon, 22 Apr 2024 13:29:26 -0700 Subject: [PATCH 2/2] version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73ae22b..5ac58da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hpt-validator", - "version": "1.3.0", + "version": "1.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hpt-validator", - "version": "1.3.0", + "version": "1.3.1", "license": "CC0-1.0", "dependencies": { "@streamparser/json": "^0.0.17", diff --git a/package.json b/package.json index ba860cc..0e53f07 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hpt-validator", - "version": "1.3.0", + "version": "1.3.1", "author": "CMS Open Source ", "license": "CC0-1.0", "description": "Validation library for CMS Hospital Price Transparency machine-readable files",