• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

everit-org / json-schema / 586 / 1
92%
master: 92%

Build:
DEFAULT BRANCH: master
Ran 22 Dec 2019 07:35PM UTC
Files 101
Run time 5s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

22 Dec 2019 07:31PM UTC coverage: 91.495%. Remained the same
586.1

push

travis-ci

erosb
schema loading performance improvement - fixes #348

Context: properly handle references by $id values, whenever we encounter a $ref, after resolving the root schema json,
we have to check if the fragment part of the $ref identifies a subschema by $id. (We have to do it even in cases when
the fragment part is a valid json pointer, because nothing stops a schema author to set $id to be a json pointer string
 - see `ReferenceLookupTest#idAsJsonPointerWorks()` covering this case). To perform this $id check, until now, we always
deep-traversed the entire root schema json for each encountered $ref, looking for a matching $id.

This repeated deep-traversal caused crazy performance problems with extremely big schemas, utilizing a lot of $refs.

This change fixes this problem by deep-traversing each involved json document at most once, at least for document-local
references. `LoadingState` gains a <rootSchema, SubschemaRegistry> map, where SubschemaRegistry is essentially a map of
<$id, subschemaJson> pairs. The registry for a root json is initialized at the first time when it is necessary to look up
a $ref in the json. The registry eagerly deep-traverses the whole root json, and collects the $id -> subschemaJson pairs.
Later the lookup-by-$id part of the $ref lookup process is just an O(1) hashmap lookup.

API changes: no, all affected and newly introduced classes are package-private.

Performance improvements based on local testing: ran a validation with ECV-JsonSchema-tNoBOM.json schema and empty json
instance ({}),
 * with 1.12.0: loading didn't complete (killed the process after 20 minutes)
 * with HEAD: schema loaded & validation passed in ~30 seconds.

3152 of 3445 relevant lines covered (91.49%)

0.91 hits per line

Source Files on job 586.1
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 515
  • Travis Job 586.1
  • f493f0c0 on github
  • Prev Job for on master (#585.1)
  • Next Job for on master (#587.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc