Skip to content

Commit

Permalink
Merge pull request #579 from SergioCasCeb/jsonld-changes-new-sergio
Browse files Browse the repository at this point in the history
Updated the jsonld dependency
  • Loading branch information
egekorkan committed Apr 26, 2024
2 parents 966e3f9 + 0233c7f commit 9e165ac
Show file tree
Hide file tree
Showing 3 changed files with 381 additions and 762 deletions.
18 changes: 15 additions & 3 deletions packages/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const fullTdSchema = require("./td-schema-full.json");
const tmSchema = require("./tm-schema.json");
const builder = require("junit-report-builder");

const jsonValidator = require("json-dup-key-validator");

module.exports.tdValidator = tdValidator;
module.exports.tmValidator = tmValidator;
module.exports.propUniqueness = coreAssertions.checkPropUniqueness;
Expand All @@ -42,7 +44,15 @@ module.exports.detectProtocolSchemes = detectProtocolSchemes;
module.exports.convertTDJsonToYaml = convertTDJsonToYaml;
module.exports.convertTDYamlToJson = convertTDYamlToJson;

const jsonValidator = require("json-dup-key-validator");

// This is implemented to avoid a test error, where jest seems to intercept the request
const customLoader = async (url) => {
return {
contextUrl: null, // this is for a context via a link header
document: {}, // this is the actual document that was loaded
documentUrl: url // this is the actual context URL after redirects
};
};

/**
* A function that provides the core functionality of the TD Playground.
Expand Down Expand Up @@ -260,7 +270,8 @@ function tdValidator(
start = Date.now();
jsonld
.toRDF(tdJson, {
format: "application/nquads",
format: "application/n-quads",
documentLoader: customLoader,
})
.then(
(nquads) => {
Expand Down Expand Up @@ -853,7 +864,8 @@ function tmValidator(tmString, logFunc, { checkDefaults = true, checkJsonLd = tr
start = Date.now();
jsonld
.toRDF(tmJson, {
format: "application/nquads",
format: "application/n-quads",
documentLoader: customLoader,
})
.then(
(nquads) => {
Expand Down
Loading

0 comments on commit 9e165ac

Please sign in to comment.