From 9203e6850656ab0c5f70f8510370430d13a357c4 Mon Sep 17 00:00:00 2001 From: Mint Thompson Date: Thu, 29 Aug 2024 11:45:17 -0400 Subject: [PATCH] Match metadata paths in JSON parser Specify paths for defined metadata elements instead of matching all top-level elements. This allows the parser to skip undefined elements, which speeds up parsing. --- src/versions/2.0/json.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/versions/2.0/json.ts b/src/versions/2.0/json.ts index 14da5ab..a4fc52b 100644 --- a/src/versions/2.0/json.ts +++ b/src/versions/2.0/json.ts @@ -371,7 +371,17 @@ export async function validateJson( const validator = new Ajv({ allErrors: true }) addFormats(validator) const parser = new JSONParser({ - paths: ["$.*", "$.standard_charge_information.*"], + paths: [ + "$.hospital_name", + "$.last_updated_on", + "$.license_information", + "$.version", + "$.hospital_address", + "$.hospital_location", + "$.affirmation", + "$.modifier_information", + "$.standard_charge_information.*", + ], keepStack: false, }) // eslint-disable-next-line @typescript-eslint/no-explicit-any