Skip to content

Commit

Permalink
Match metadata paths in JSON parser (#55)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mint-thompson authored Aug 30, 2024
1 parent 78014ba commit cfed514
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/versions/2.0/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cfed514

Please sign in to comment.