google / schemarama

Schemarama is a project exploring standards-based validation for structured data, especially Schema.org.
Apache License 2.0
124 stars 22 forks source link

Fix errors in shex module #23

Closed elizusha closed 3 years ago

elizusha commented 3 years ago

Right now when trying to use schemarama as npm module, the code fails in shex file on two lines with the following errors:

Uncaught ReferenceError: testRange is not defined
    at eval (shex.js:2989)
Uncaught ReferenceError: ShExJison is not defined
    at eval (shex.js:5675)

In the shex repo, these errors are fixed:

  1. https://github.com/shexSpec/shex.js/blob/c5ed1ffbf3e87224050a179d8bcd0db718f9ec3a/packages/shex-parser/shex-parser.js#L3
  2. https://github.com/shexSpec/shex.js/blob/c5ed1ffbf3e87224050a179d8bcd0db718f9ec3a/packages/shex-validator/shex-validator.js#L95

The proper solution is to regenerate shex bundle, but for now the quickest solution is to patch the code directly. This PR makes schemarama works for me.