From 7804c78a53f25d98de9457e12d2bdbd4b40e682b Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Thu, 6 Jul 2023 17:52:57 +0200 Subject: [PATCH] fix: properly set the `referencedItems` field in the JSON report See #1515 --- .../core/references/ResourceReferencesChecker.java | 4 ++++ src/test/resources/reporting/json-report.feature | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/org/w3c/epubcheck/core/references/ResourceReferencesChecker.java b/src/main/java/org/w3c/epubcheck/core/references/ResourceReferencesChecker.java index 21074cb60..2f1dd0880 100755 --- a/src/main/java/org/w3c/epubcheck/core/references/ResourceReferencesChecker.java +++ b/src/main/java/org/w3c/epubcheck/core/references/ResourceReferencesChecker.java @@ -43,6 +43,7 @@ import com.adobe.epubcheck.opf.OPFChecker30; import com.adobe.epubcheck.opf.ValidationContext; import com.adobe.epubcheck.util.EPUBVersion; +import com.adobe.epubcheck.util.FeatureEnum; import com.google.common.base.Preconditions; import io.mola.galimatias.URL; @@ -108,6 +109,9 @@ public void check() private void checkReference(Reference reference) { + // Report the reference + report.info(reference.location.getPath(), FeatureEnum.RESOURCE, container.relativize(reference.url)); + // Retrieve the target resource Optional targetResource = resourceRegistry.getResource(reference.targetResource); try diff --git a/src/test/resources/reporting/json-report.feature b/src/test/resources/reporting/json-report.feature index 3d53596bb..9f02693b6 100644 --- a/src/test/resources/reporting/json-report.feature +++ b/src/test/resources/reporting/json-report.feature @@ -13,6 +13,14 @@ Then the JSON report is valid And JSON at '$.items' contains 5 items And JSON at '$..checkSum' has no null values + + ## References + + Scenario: cross-HTML references + When checking EPUB 'minimal' + Then the JSON report is valid + And JSON at '$..items[?(@.id=="nav")].referencedItems[0]' is: + | EPUB/content_001.xhtml | ## Layout