Skip to content

Commit e2a41c3

Browse files
Fixes in FilebasedResource to better support nontabular data.
Fix for a bug in FilebasedResource returning the format.
1 parent fc7546e commit e2a41c3

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/main/java/io/frictionlessdata/datapackage/resource/Resource.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ static AbstractResource fromJSON(
400400
if (path != null){
401401
Collection paths = fromJSON(path, basePath);
402402
resource = build(name, paths, basePath, charset);
403+
resource.setFormat(format);
403404
if (resource instanceof FilebasedResource) {
404405
((FilebasedResource)resource).setIsInArchive(isArchivePackage);
405406
}

src/test/java/io/frictionlessdata/datapackage/resource/NonTabularResourceTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ public void testCreateAndReadZippedPackageWithJsonObject() throws Exception {
413413
// Verify the content of the resource
414414
byte[] readData = (byte[]) readResource.getRawData();
415415
Assertions.assertArrayEquals(jsonBytes, readData);
416+
Assertions.assertEquals("json", readResource.getFormat());
416417
}
417418

418419

src/test/java/io/frictionlessdata/datapackage/resource/RoundtripTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ private static String createCSV(String[] headers, List<Object[]> data) {
183183
" \"name\" : \"test3\",\n" +
184184
" \"profile\" : \"tabular-data-resource\",\n" +
185185
" \"encoding\" : \"utf-8\",\n" +
186+
" \"format\" : \"csv\",\n"+
186187
" \"dialect\" : \"dialect/test3.json\",\n" +
187188
" \"schema\" : \"schema/population_schema.json\",\n" +
188189
" \"path\" : \"data/test3.csv\"\n" +

0 commit comments

Comments
 (0)