diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f4113e0..8011e21 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,3 +67,18 @@ you need to manually install it, then you can run : `composer style-check` or `c The json schemas for the frictionlessdata specs are stored locally as part of the package. They might change from time to time, to donwnload the latest specs run `composer update_registry` + +## Testing with a local copy of tableschema-php + +Add the following to `composer.json` + +``` +"repositories": [ + { + "type": "path", + "url": "../tableschema-php" + } +] +``` + +Run `composer update` diff --git a/composer.json b/composer.json index 8cc4282..8407f32 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "require": { "php": ">=5.4", "justinrainbow/json-schema": "^5.2", - "frictionlessdata/tableschema": "^0.1.6", + "frictionlessdata/tableschema": "^0.1.7", "alchemy/zippy": "=0.3.5" }, "require-dev": { diff --git a/src/Package.php b/src/Package.php index a358886..e7c8105 100644 --- a/src/Package.php +++ b/src/Package.php @@ -4,9 +4,9 @@ class Package { - public static function load($source, $basePath = null) + public static function load($source, $basePath = null, $options = null) { - return Factory::datapackage($source, $basePath); + return Factory::datapackage($source, $basePath, $options); } public static function validate($source, $basePath = null) diff --git a/src/Validators/schemas/CHANGELOG b/src/Validators/schemas/CHANGELOG index c074aba..dcc64a0 100644 --- a/src/Validators/schemas/CHANGELOG +++ b/src/Validators/schemas/CHANGELOG @@ -6,3 +6,17 @@ * changed role enum * data attribute changed to path which can be either a single string or array of strings * changes to table-schema (not affecting datapackage directly) + +2017-11-21T20:55:19+02:00 + +* added schemas from registry: data-resource, tabular-data-resource +* default profile changed from 'default' to 'data-package' +* homepage type changed from 'object' to 'string' with format 'uri' +* changed contributor 'name' attribute to 'title' +* added default contributor role - 'contributor' +* added image attribute - an image to represent the data package (string) +* license name - must be an Open Definition license identifier - "^([-a-zA-Z0-9._])+$" +* resource must have either one of "data" or "path" attribute (but not both) +* default resource profile changed from 'default' to 'data-resource' +* added 'data' - Inline data for this resource +* changed source 'name' attribute to 'title' diff --git a/src/Validators/schemas/data-package.json b/src/Validators/schemas/data-package.json index 865488a..78d7386 100644 --- a/src/Validators/schemas/data-package.json +++ b/src/Validators/schemas/data-package.json @@ -8,12 +8,12 @@ ], "properties": { "profile": { + "default": "data-package", "propertyOrder": 10, "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -64,39 +64,10 @@ "propertyOrder": 60, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "created": { @@ -120,14 +91,12 @@ "title": "Contributor", "description": "A contributor to this descriptor.", "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -150,7 +119,7 @@ ] }, "organisation": { - "title": "Organisation", + "title": "Organization", "description": "An organizational affiliation for this contributor.", "type": "string" }, @@ -162,17 +131,18 @@ "maintainer", "wrangler", "contributor" - ] + ], + "default": "contributor" } }, "required": [ - "name" + "title" ], "context": "Use of this property does not imply that the person was the original creator of, or a contributor to, the data in the descriptor, but refers to the composition of the descriptor itself." }, "examples": [ - "{\n \"contributors\": [\n {\n \"name\": \"Joe Bloggs\"\n }\n ]\n}\n", - "{\n \"contributors\": [\n {\n \"name\": \"Joe Bloggs\",\n \"email\": \"joe@example.com\",\n \"role\": \"author\"\n }\n ]\n}\n" + "{\n \"contributors\": [\n {\n \"title\": \"Joe Bloggs\"\n }\n ]\n}\n", + "{\n \"contributors\": [\n {\n \"title\": \"Joe Bloggs\",\n \"email\": \"joe@example.com\",\n \"role\": \"author\"\n }\n ]\n}\n" ] }, "keywords": { @@ -188,8 +158,18 @@ "{\n \"keywords\": [\n \"data\",\n \"fiscal\",\n \"transparency\"\n ]\n}\n" ] }, - "licenses": { + "image": { "propertyOrder": 100, + "title": "Image", + "description": "A image to represent this package.", + "type": "string", + "examples": [ + "{\n \"image\": \"http://example.com/image.jpg\"\n}\n", + "{\n \"image\": \"relative/to/image.jpg\"\n}\n" + ] + }, + "licenses": { + "propertyOrder": 110, "title": "Licenses", "description": "The license(s) under which this package is published.", "type": "array", @@ -198,19 +178,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", @@ -239,7 +212,7 @@ ] }, "resources": { - "propertyOrder": 110, + "propertyOrder": 120, "title": "Data Resources", "description": "An `array` of Data Resource objects, each compliant with the [Data Resource](/data-resource/) specification.", "type": "array", @@ -248,18 +221,28 @@ "title": "Data Resource", "description": "Data Resource.", "type": "object", - "required": [ - "name", - "path" + "oneOf": [ + { + "required": [ + "name", + "data" + ] + }, + { + "required": [ + "name", + "path" + ] + } ], "properties": { "profile": { "propertyOrder": 10, + "default": "data-resource", "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -317,6 +300,11 @@ "{\n \"path\": \"http://example.com/file.csv\"\n}\n" ] }, + "data": { + "propertyOrder": 230, + "title": "Data", + "description": "Inline data for this resource." + }, "schema": { "propertyOrder": 40, "title": "Schema", @@ -346,39 +334,10 @@ "propertyOrder": 70, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "sources": { @@ -395,17 +354,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -446,19 +403,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", @@ -562,17 +512,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { diff --git a/src/Validators/schemas/data-resource.json b/src/Validators/schemas/data-resource.json index a78ecfb..87f3f38 100644 --- a/src/Validators/schemas/data-resource.json +++ b/src/Validators/schemas/data-resource.json @@ -3,18 +3,28 @@ "title": "Data Resource", "description": "Data Resource.", "type": "object", - "required": [ - "name", - "path" + "oneOf": [ + { + "required": [ + "name", + "data" + ] + }, + { + "required": [ + "name", + "path" + ] + } ], "properties": { "profile": { "propertyOrder": 10, + "default": "data-resource", "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -72,6 +82,11 @@ "{\n \"path\": \"http://example.com/file.csv\"\n}\n" ] }, + "data": { + "propertyOrder": 230, + "title": "Data", + "description": "Inline data for this resource." + }, "schema": { "propertyOrder": 40, "title": "Schema", @@ -101,39 +116,10 @@ "propertyOrder": 70, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "sources": { @@ -150,17 +136,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -201,19 +185,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", diff --git a/src/Validators/schemas/fiscal-data-package.json b/src/Validators/schemas/fiscal-data-package.json index 1ab20e9..4067839 100644 --- a/src/Validators/schemas/fiscal-data-package.json +++ b/src/Validators/schemas/fiscal-data-package.json @@ -14,12 +14,14 @@ ], "properties": { "profile": { + "enum": [ + "tabular-data-package" + ], "propertyOrder": 10, "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -70,39 +72,10 @@ "propertyOrder": 60, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "created": { @@ -126,14 +99,12 @@ "title": "Contributor", "description": "A contributor to this descriptor.", "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -156,7 +127,7 @@ ] }, "organisation": { - "title": "Organisation", + "title": "Organization", "description": "An organizational affiliation for this contributor.", "type": "string" }, @@ -168,17 +139,18 @@ "maintainer", "wrangler", "contributor" - ] + ], + "default": "contributor" } }, "required": [ - "name" + "title" ], "context": "Use of this property does not imply that the person was the original creator of, or a contributor to, the data in the descriptor, but refers to the composition of the descriptor itself." }, "examples": [ - "{\n \"contributors\": [\n {\n \"name\": \"Joe Bloggs\"\n }\n ]\n}\n", - "{\n \"contributors\": [\n {\n \"name\": \"Joe Bloggs\",\n \"email\": \"joe@example.com\",\n \"role\": \"author\"\n }\n ]\n}\n" + "{\n \"contributors\": [\n {\n \"title\": \"Joe Bloggs\"\n }\n ]\n}\n", + "{\n \"contributors\": [\n {\n \"title\": \"Joe Bloggs\",\n \"email\": \"joe@example.com\",\n \"role\": \"author\"\n }\n ]\n}\n" ] }, "keywords": { @@ -194,8 +166,18 @@ "{\n \"keywords\": [\n \"data\",\n \"fiscal\",\n \"transparency\"\n ]\n}\n" ] }, - "licenses": { + "image": { "propertyOrder": 100, + "title": "Image", + "description": "A image to represent this package.", + "type": "string", + "examples": [ + "{\n \"image\": \"http://example.com/image.jpg\"\n}\n", + "{\n \"image\": \"relative/to/image.jpg\"\n}\n" + ] + }, + "licenses": { + "propertyOrder": 110, "title": "Licenses", "description": "The license(s) under which this package is published.", "type": "array", @@ -204,19 +186,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", @@ -245,7 +220,7 @@ ] }, "resources": { - "propertyOrder": 110, + "propertyOrder": 120, "title": "Tabular Data Resources", "description": "An `array` of Tabular Data Resource objects, each compliant with the [Tabular Data Resource](/tabular-data-resource/) specification.", "type": "array", @@ -254,20 +229,34 @@ "title": "Tabular Data Resource", "description": "A Tabular Data Resource.", "type": "object", - "required": [ - "name", - "path", - "schema", - "profile" + "oneOf": [ + { + "required": [ + "name", + "data", + "schema", + "profile" + ] + }, + { + "required": [ + "name", + "path", + "schema", + "profile" + ] + } ], "properties": { "profile": { + "enum": [ + "tabular-data-resource" + ], "propertyOrder": 10, "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -325,6 +314,11 @@ "{\n \"path\": \"http://example.com/file.csv\"\n}\n" ] }, + "data": { + "propertyOrder": 230, + "title": "Data", + "description": "Inline data for this resource." + }, "schema": { "propertyOrder": 40, "title": "Table Schema", @@ -351,13 +345,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -452,13 +441,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -489,6 +473,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "decimalChar": { "type": "string", "description": "A string whose value is used to represent a decimal point within the number. The default value is `.`." @@ -497,10 +487,6 @@ "type": "string", "description": "A string whose value is used to group digits within the number. The default value is `null`. A common value is `,` e.g. '100,000'." }, - "currency": { - "type": "string", - "description": "A number that may include additional currency symbols." - }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `number` fields.", @@ -584,13 +570,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -621,6 +602,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `integer` fields.", @@ -702,13 +689,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -789,13 +771,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -875,13 +852,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -961,13 +933,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1075,13 +1042,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1168,13 +1130,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1264,13 +1221,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1365,13 +1317,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1473,13 +1420,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1577,13 +1519,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1679,13 +1616,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1766,13 +1698,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1866,9 +1793,9 @@ "fields", "reference" ], - "properties": { - "oneOf": [ - { + "oneOf": [ + { + "properties": { "fields": { "type": "array", "items": { @@ -1899,8 +1826,10 @@ } } } - }, - { + } + }, + { + "properties": { "fields": { "type": "string", "description": "Fields that make up the primary key." @@ -1922,8 +1851,8 @@ } } } - ] - } + } + ] }, "examples": [ "{\n \"foreignKeys\": [\n {\n \"fields\": \"state\",\n \"reference\": {\n \"resource\": \"the-resource\",\n \"fields\": \"state_id\"\n }\n }\n ]\n}\n", @@ -1973,39 +1902,10 @@ "propertyOrder": 70, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "sources": { @@ -2022,17 +1922,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -2073,19 +1971,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", @@ -2290,17 +2181,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -2346,20 +2235,34 @@ "title": "Tabular Data Resource", "description": "A Tabular Data Resource.", "type": "object", - "required": [ - "name", - "path", - "schema", - "profile" + "oneOf": [ + { + "required": [ + "name", + "data", + "schema", + "profile" + ] + }, + { + "required": [ + "name", + "path", + "schema", + "profile" + ] + } ], "properties": { "profile": { + "enum": [ + "tabular-data-resource" + ], "propertyOrder": 10, "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -2417,6 +2320,11 @@ "{\n \"path\": \"http://example.com/file.csv\"\n}\n" ] }, + "data": { + "propertyOrder": 230, + "title": "Data", + "description": "Inline data for this resource." + }, "schema": { "propertyOrder": 40, "title": "Table Schema", @@ -2443,13 +2351,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -2544,13 +2447,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -2581,6 +2479,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "decimalChar": { "type": "string", "description": "A string whose value is used to represent a decimal point within the number. The default value is `.`." @@ -2589,10 +2493,6 @@ "type": "string", "description": "A string whose value is used to group digits within the number. The default value is `null`. A common value is `,` e.g. '100,000'." }, - "currency": { - "type": "string", - "description": "A number that may include additional currency symbols." - }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `number` fields.", @@ -2676,13 +2576,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -2713,6 +2608,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `integer` fields.", @@ -2794,13 +2695,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -2881,13 +2777,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -2967,13 +2858,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3053,13 +2939,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3167,13 +3048,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3260,13 +3136,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3356,13 +3227,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3457,13 +3323,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3565,13 +3426,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3669,13 +3525,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3771,13 +3622,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3858,13 +3704,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -3958,9 +3799,9 @@ "fields", "reference" ], - "properties": { - "oneOf": [ - { + "oneOf": [ + { + "properties": { "fields": { "type": "array", "items": { @@ -3991,8 +3832,10 @@ } } } - }, - { + } + }, + { + "properties": { "fields": { "type": "string", "description": "Fields that make up the primary key." @@ -4014,8 +3857,8 @@ } } } - ] - } + } + ] }, "examples": [ "{\n \"foreignKeys\": [\n {\n \"fields\": \"state\",\n \"reference\": {\n \"resource\": \"the-resource\",\n \"fields\": \"state_id\"\n }\n }\n ]\n}\n", @@ -4065,39 +3908,10 @@ "propertyOrder": 70, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "sources": { @@ -4114,17 +3928,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -4165,19 +3977,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", diff --git a/src/Validators/schemas/registry.json b/src/Validators/schemas/registry.json index dcda0b6..9fa2076 100644 --- a/src/Validators/schemas/registry.json +++ b/src/Validators/schemas/registry.json @@ -20,6 +20,20 @@ "schema_path": "fiscal-data-package.json", "specification": "https://specs.frictionlessdata.io/fiscal-data-package/" }, + { + "id": "data-resource", + "title": "Data Resource", + "schema": "https://specs.frictionlessdata.io/schemas/data-resource.json", + "schema_path": "data-resource.json", + "specification": "https://specs.frictionlessdata.io/data-resource" + }, + { + "id": "tabular-data-resource", + "title": "Tabular Data Resource", + "schema": "https://specs.frictionlessdata.io/schemas/tabular-data-resource.json", + "schema_path": "tabular-data-resource.json", + "specification": "https://specs.frictionlessdata.io/tabular-data-resource" + }, { "id": "table-schema", "title": "Table Schema", diff --git a/src/Validators/schemas/table-schema.json b/src/Validators/schemas/table-schema.json index bed51fa..28e74ce 100644 --- a/src/Validators/schemas/table-schema.json +++ b/src/Validators/schemas/table-schema.json @@ -24,13 +24,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -125,13 +120,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -162,6 +152,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "decimalChar": { "type": "string", "description": "A string whose value is used to represent a decimal point within the number. The default value is `.`." @@ -170,10 +166,6 @@ "type": "string", "description": "A string whose value is used to group digits within the number. The default value is `null`. A common value is `,` e.g. '100,000'." }, - "currency": { - "type": "string", - "description": "A number that may include additional currency symbols." - }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `number` fields.", @@ -257,13 +249,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -294,6 +281,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `integer` fields.", @@ -375,13 +368,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -462,13 +450,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -548,13 +531,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -634,13 +612,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -748,13 +721,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -841,13 +809,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -937,13 +900,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1038,13 +996,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1146,13 +1099,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1250,13 +1198,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1352,13 +1295,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1439,13 +1377,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1539,9 +1472,9 @@ "fields", "reference" ], - "properties": { - "oneOf": [ - { + "oneOf": [ + { + "properties": { "fields": { "type": "array", "items": { @@ -1572,8 +1505,10 @@ } } } - }, - { + } + }, + { + "properties": { "fields": { "type": "string", "description": "Fields that make up the primary key." @@ -1595,8 +1530,8 @@ } } } - ] - } + } + ] }, "examples": [ "{\n \"foreignKeys\": [\n {\n \"fields\": \"state\",\n \"reference\": {\n \"resource\": \"the-resource\",\n \"fields\": \"state_id\"\n }\n }\n ]\n}\n", diff --git a/src/Validators/schemas/tabular-data-package.json b/src/Validators/schemas/tabular-data-package.json index 4f82285..9bbdc94 100644 --- a/src/Validators/schemas/tabular-data-package.json +++ b/src/Validators/schemas/tabular-data-package.json @@ -9,12 +9,14 @@ ], "properties": { "profile": { + "enum": [ + "tabular-data-package" + ], "propertyOrder": 10, "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -65,39 +67,10 @@ "propertyOrder": 60, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "created": { @@ -121,14 +94,12 @@ "title": "Contributor", "description": "A contributor to this descriptor.", "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -151,7 +122,7 @@ ] }, "organisation": { - "title": "Organisation", + "title": "Organization", "description": "An organizational affiliation for this contributor.", "type": "string" }, @@ -163,17 +134,18 @@ "maintainer", "wrangler", "contributor" - ] + ], + "default": "contributor" } }, "required": [ - "name" + "title" ], "context": "Use of this property does not imply that the person was the original creator of, or a contributor to, the data in the descriptor, but refers to the composition of the descriptor itself." }, "examples": [ - "{\n \"contributors\": [\n {\n \"name\": \"Joe Bloggs\"\n }\n ]\n}\n", - "{\n \"contributors\": [\n {\n \"name\": \"Joe Bloggs\",\n \"email\": \"joe@example.com\",\n \"role\": \"author\"\n }\n ]\n}\n" + "{\n \"contributors\": [\n {\n \"title\": \"Joe Bloggs\"\n }\n ]\n}\n", + "{\n \"contributors\": [\n {\n \"title\": \"Joe Bloggs\",\n \"email\": \"joe@example.com\",\n \"role\": \"author\"\n }\n ]\n}\n" ] }, "keywords": { @@ -189,8 +161,18 @@ "{\n \"keywords\": [\n \"data\",\n \"fiscal\",\n \"transparency\"\n ]\n}\n" ] }, - "licenses": { + "image": { "propertyOrder": 100, + "title": "Image", + "description": "A image to represent this package.", + "type": "string", + "examples": [ + "{\n \"image\": \"http://example.com/image.jpg\"\n}\n", + "{\n \"image\": \"relative/to/image.jpg\"\n}\n" + ] + }, + "licenses": { + "propertyOrder": 110, "title": "Licenses", "description": "The license(s) under which this package is published.", "type": "array", @@ -199,19 +181,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", @@ -240,7 +215,7 @@ ] }, "resources": { - "propertyOrder": 110, + "propertyOrder": 120, "title": "Tabular Data Resources", "description": "An `array` of Tabular Data Resource objects, each compliant with the [Tabular Data Resource](/tabular-data-resource/) specification.", "type": "array", @@ -249,20 +224,34 @@ "title": "Tabular Data Resource", "description": "A Tabular Data Resource.", "type": "object", - "required": [ - "name", - "path", - "schema", - "profile" + "oneOf": [ + { + "required": [ + "name", + "data", + "schema", + "profile" + ] + }, + { + "required": [ + "name", + "path", + "schema", + "profile" + ] + } ], "properties": { "profile": { + "enum": [ + "tabular-data-resource" + ], "propertyOrder": 10, "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -320,6 +309,11 @@ "{\n \"path\": \"http://example.com/file.csv\"\n}\n" ] }, + "data": { + "propertyOrder": 230, + "title": "Data", + "description": "Inline data for this resource." + }, "schema": { "propertyOrder": 40, "title": "Table Schema", @@ -346,13 +340,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -447,13 +436,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -484,6 +468,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "decimalChar": { "type": "string", "description": "A string whose value is used to represent a decimal point within the number. The default value is `.`." @@ -492,10 +482,6 @@ "type": "string", "description": "A string whose value is used to group digits within the number. The default value is `null`. A common value is `,` e.g. '100,000'." }, - "currency": { - "type": "string", - "description": "A number that may include additional currency symbols." - }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `number` fields.", @@ -579,13 +565,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -616,6 +597,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `integer` fields.", @@ -697,13 +684,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -784,13 +766,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -870,13 +847,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -956,13 +928,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1070,13 +1037,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1163,13 +1125,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1259,13 +1216,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1360,13 +1312,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1468,13 +1415,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1572,13 +1514,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1674,13 +1611,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1761,13 +1693,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1861,9 +1788,9 @@ "fields", "reference" ], - "properties": { - "oneOf": [ - { + "oneOf": [ + { + "properties": { "fields": { "type": "array", "items": { @@ -1894,8 +1821,10 @@ } } } - }, - { + } + }, + { + "properties": { "fields": { "type": "string", "description": "Fields that make up the primary key." @@ -1917,8 +1846,8 @@ } } } - ] - } + } + ] }, "examples": [ "{\n \"foreignKeys\": [\n {\n \"fields\": \"state\",\n \"reference\": {\n \"resource\": \"the-resource\",\n \"fields\": \"state_id\"\n }\n }\n ]\n}\n", @@ -1968,39 +1897,10 @@ "propertyOrder": 70, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "sources": { @@ -2017,17 +1917,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -2068,19 +1966,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", @@ -2285,17 +2176,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { diff --git a/src/Validators/schemas/tabular-data-resource.json b/src/Validators/schemas/tabular-data-resource.json index 664df2e..def495e 100644 --- a/src/Validators/schemas/tabular-data-resource.json +++ b/src/Validators/schemas/tabular-data-resource.json @@ -3,20 +3,34 @@ "title": "Tabular Data Resource", "description": "A Tabular Data Resource.", "type": "object", - "required": [ - "name", - "path", - "schema", - "profile" + "oneOf": [ + { + "required": [ + "name", + "data", + "schema", + "profile" + ] + }, + { + "required": [ + "name", + "path", + "schema", + "profile" + ] + } ], "properties": { "profile": { + "enum": [ + "tabular-data-resource" + ], "propertyOrder": 10, "title": "Profile", "description": "The profile of this descriptor.", - "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", + "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.", "type": "string", - "default": "default", "examples": [ "{\n \"profile\": \"tabular-data-package\"\n}\n", "{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" @@ -74,6 +88,11 @@ "{\n \"path\": \"http://example.com/file.csv\"\n}\n" ] }, + "data": { + "propertyOrder": 230, + "title": "Data", + "description": "Inline data for this resource." + }, "schema": { "propertyOrder": 40, "title": "Table Schema", @@ -100,13 +119,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -201,13 +215,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -238,6 +247,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "decimalChar": { "type": "string", "description": "A string whose value is used to represent a decimal point within the number. The default value is `.`." @@ -246,10 +261,6 @@ "type": "string", "description": "A string whose value is used to group digits within the number. The default value is `null`. A common value is `,` e.g. '100,000'." }, - "currency": { - "type": "string", - "description": "A number that may include additional currency symbols." - }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `number` fields.", @@ -333,13 +344,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -370,6 +376,12 @@ ], "default": "default" }, + "bareNumber": { + "type": "boolean", + "title": "bareNumber", + "description": "a boolean field with a default of `true`. If `true` the physical contents of this field must follow the formatting constraints already set out. If `false` the contents of this field may contain leading and/or trailing non-numeric characters (which implementors MUST therefore strip). The purpose of `bareNumber` is to allow publishers to publish numeric data that contains trailing characters such as percentages e.g. `95%` or leading characters such as currencies e.g. `€95` or `EUR 95`. Note that it is entirely up to implementors what, if anything, they do with stripped text.", + "default": true + }, "constraints": { "title": "Constraints", "description": "The following constraints are supported for `integer` fields.", @@ -451,13 +463,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -538,13 +545,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -624,13 +626,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -710,13 +707,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -824,13 +816,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -917,13 +904,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1013,13 +995,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1114,13 +1091,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1222,13 +1194,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1326,13 +1293,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1428,13 +1390,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1515,13 +1472,8 @@ "properties": { "name": { "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "description": "A name for this field.", + "type": "string" }, "title": { "title": "Title", @@ -1615,9 +1567,9 @@ "fields", "reference" ], - "properties": { - "oneOf": [ - { + "oneOf": [ + { + "properties": { "fields": { "type": "array", "items": { @@ -1648,8 +1600,10 @@ } } } - }, - { + } + }, + { + "properties": { "fields": { "type": "string", "description": "Fields that make up the primary key." @@ -1671,8 +1625,8 @@ } } } - ] - } + } + ] }, "examples": [ "{\n \"foreignKeys\": [\n {\n \"fields\": \"state\",\n \"reference\": {\n \"resource\": \"the-resource\",\n \"fields\": \"state_id\"\n }\n }\n ]\n}\n", @@ -1722,39 +1676,10 @@ "propertyOrder": 70, "title": "Home Page", "description": "The home on the web that is related to this data package.", - "type": "object", - "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", - "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] - }, - "path": { - "title": "Path", - "description": "A fully qualified URL, or a POSIX file path..", - "type": "string", - "examples": [ - "{\n \"path\": \"file.csv\"\n}\n", - "{\n \"path\": \"http://example.com/file.csv\"\n}\n" - ], - "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." - }, - "title": { - "title": "Title", - "description": "A human-readable title.", - "type": "string", - "examples": [ - "{\n \"title\": \"My Package Title\"\n}\n" - ] - } - }, + "type": "string", + "format": "uri", "examples": [ - "{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n" + "{\n \"homepage\": \"http://example.com/\"\n}\n" ] }, "sources": { @@ -1771,17 +1696,15 @@ "description": "A source file.", "type": "object", "required": [ - "uri" + "title" ], "properties": { - "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": { + "title": "Title", + "description": "A human-readable title.", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" + "{\n \"title\": \"My Package Title\"\n}\n" ] }, "path": { @@ -1822,19 +1745,12 @@ "title": "License", "description": "A license for this descriptor.", "type": "object", - "required": [ - "uri" - ], "properties": { "name": { - "title": "Name", - "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", + "title": "Open Definition license identifier", + "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", "type": "string", - "pattern": "^([-a-z0-9._/])+$", - "context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", - "examples": [ - "{\n \"name\": \"my-nice-name\"\n}\n" - ] + "pattern": "^([-a-zA-Z0-9._])+$" }, "path": { "title": "Path", diff --git a/tests/DatapackageTest.php b/tests/DatapackageTest.php index b799a3a..f465d16 100644 --- a/tests/DatapackageTest.php +++ b/tests/DatapackageTest.php @@ -307,21 +307,15 @@ public function testFiscalDatapackage() foreach ($dp as $resource) { $resources_data[$resource->name()] = []; foreach ($resource as $row) { - $resources_data[$resource->name()][] = trim($row); + $resources_data[$resource->name()][] = $row; } } - $this->assertEquals(array( - 'budget' => [ - 'pk,budget,budget_date,payee', - '1,10000,01/01/2015,1', - '2,20000,01/02/2015,1', - ], - 'entities' => [ - 'id,name,description', - '1,Acme 1,They are the first acme company', - '2,Acme 2,They are the sceond acme company', - ], - ), $resources_data); + $this->assertEquals([ + 'id' => null, 'amount' => null, 'date' => null, 'payee' => 1, + ], $resources_data['budget'][1]); + $this->assertEquals([ + 'id' => '1', 'title' => null, 'description' => 'They are the first acme company', + ], $resources_data['entities'][0]); } public function testCreateEditDatapackageDescriptor() @@ -530,6 +524,40 @@ public function testInlineDataRowObjects() ], $resource->read()); } + public function testDataHubCountryList() + { + // $package = Package::load("https://datahub.io/core/country-list/datapackage.json"); + $package = Package::load(dirname(__FILE__).'/fixtures/datahub-country-list/datapackage.json'); + $this->assertEquals('data-package', $package->descriptor()->profile); + $resources = []; + foreach ($package as $resource) { + $resources[$resource->name()] = []; + foreach ($resource as $row) { + // note that this is not a tabular data resource, so we return the rows as strings + $this->assertEquals('data-resource', $resource->descriptor()->profile); + $resources[$resource->name()][] = $row; + } + } + $this->assertEquals(['data_csv', 'data_json', 'datapackage_zip', 'data'], array_keys($resources)); + $this->assertEquals('Name,Code', trim($resources['data_csv'][0])); + + // now, let's try to load it but get it as tabular data + $descriptor = json_decode(file_get_contents(dirname(__FILE__).'/fixtures/datahub-country-list/datapackage.json')); + foreach ($descriptor->resources as $resource) { + if ($resource->name != 'datapackage_zip') { + $resource->profile = 'tabular-data-resource'; + } + } + $package = Package::load($descriptor, dirname(__FILE__).'/fixtures/datahub-country-list'); + $resources = []; + foreach ($package as $resource) { + $resources[$resource->name()] = []; + foreach ($resource as $row) { + $resources[$resource->name()][] = $row; + } + } + } + protected function assertDatapackageValidation($expectedMessages, $source, $basePath = null) { $validationErrors = Package::validate($source, $basePath); diff --git a/tests/fixtures/datahub-country-list/data.csv b/tests/fixtures/datahub-country-list/data.csv new file mode 100644 index 0000000..47881c6 --- /dev/null +++ b/tests/fixtures/datahub-country-list/data.csv @@ -0,0 +1,250 @@ +Name,Code +Afghanistan,AF +Åland Islands,AX +Albania,AL +Algeria,DZ +American Samoa,AS +Andorra,AD +Angola,AO +Anguilla,AI +Antarctica,AQ +Antigua and Barbuda,AG +Argentina,AR +Armenia,AM +Aruba,AW +Australia,AU +Austria,AT +Azerbaijan,AZ +Bahamas,BS +Bahrain,BH +Bangladesh,BD +Barbados,BB +Belarus,BY +Belgium,BE +Belize,BZ +Benin,BJ +Bermuda,BM +Bhutan,BT +"Bolivia, Plurinational State of",BO +"Bonaire, Sint Eustatius and Saba",BQ +Bosnia and Herzegovina,BA +Botswana,BW +Bouvet Island,BV +Brazil,BR +British Indian Ocean Territory,IO +Brunei Darussalam,BN +Bulgaria,BG +Burkina Faso,BF +Burundi,BI +Cambodia,KH +Cameroon,CM +Canada,CA +Cape Verde,CV +Cayman Islands,KY +Central African Republic,CF +Chad,TD +Chile,CL +China,CN +Christmas Island,CX +Cocos (Keeling) Islands,CC +Colombia,CO +Comoros,KM +Congo,CG +"Congo, the Democratic Republic of the",CD +Cook Islands,CK +Costa Rica,CR +Côte d'Ivoire,CI +Croatia,HR +Cuba,CU +Curaçao,CW +Cyprus,CY +Czech Republic,CZ +Denmark,DK +Djibouti,DJ +Dominica,DM +Dominican Republic,DO +Ecuador,EC +Egypt,EG +El Salvador,SV +Equatorial Guinea,GQ +Eritrea,ER +Estonia,EE +Ethiopia,ET +Falkland Islands (Malvinas),FK +Faroe Islands,FO +Fiji,FJ +Finland,FI +France,FR +French Guiana,GF +French Polynesia,PF +French Southern Territories,TF +Gabon,GA +Gambia,GM +Georgia,GE +Germany,DE +Ghana,GH +Gibraltar,GI +Greece,GR +Greenland,GL +Grenada,GD +Guadeloupe,GP +Guam,GU +Guatemala,GT +Guernsey,GG +Guinea,GN +Guinea-Bissau,GW +Guyana,GY +Haiti,HT +Heard Island and McDonald Islands,HM +Holy See (Vatican City State),VA +Honduras,HN +Hong Kong,HK +Hungary,HU +Iceland,IS +India,IN +Indonesia,ID +"Iran, Islamic Republic of",IR +Iraq,IQ +Ireland,IE +Isle of Man,IM +Israel,IL +Italy,IT +Jamaica,JM +Japan,JP +Jersey,JE +Jordan,JO +Kazakhstan,KZ +Kenya,KE +Kiribati,KI +"Korea, Democratic People's Republic of",KP +"Korea, Republic of",KR +Kuwait,KW +Kyrgyzstan,KG +Lao People's Democratic Republic,LA +Latvia,LV +Lebanon,LB +Lesotho,LS +Liberia,LR +Libya,LY +Liechtenstein,LI +Lithuania,LT +Luxembourg,LU +Macao,MO +"Macedonia, the Former Yugoslav Republic of",MK +Madagascar,MG +Malawi,MW +Malaysia,MY +Maldives,MV +Mali,ML +Malta,MT +Marshall Islands,MH +Martinique,MQ +Mauritania,MR +Mauritius,MU +Mayotte,YT +Mexico,MX +"Micronesia, Federated States of",FM +"Moldova, Republic of",MD +Monaco,MC +Mongolia,MN +Montenegro,ME +Montserrat,MS +Morocco,MA +Mozambique,MZ +Myanmar,MM +Namibia,NA +Nauru,NR +Nepal,NP +Netherlands,NL +New Caledonia,NC +New Zealand,NZ +Nicaragua,NI +Niger,NE +Nigeria,NG +Niue,NU +Norfolk Island,NF +Northern Mariana Islands,MP +Norway,NO +Oman,OM +Pakistan,PK +Palau,PW +"Palestine, State of",PS +Panama,PA +Papua New Guinea,PG +Paraguay,PY +Peru,PE +Philippines,PH +Pitcairn,PN +Poland,PL +Portugal,PT +Puerto Rico,PR +Qatar,QA +Réunion,RE +Romania,RO +Russian Federation,RU +Rwanda,RW +Saint Barthélemy,BL +"Saint Helena, Ascension and Tristan da Cunha",SH +Saint Kitts and Nevis,KN +Saint Lucia,LC +Saint Martin (French part),MF +Saint Pierre and Miquelon,PM +Saint Vincent and the Grenadines,VC +Samoa,WS +San Marino,SM +Sao Tome and Principe,ST +Saudi Arabia,SA +Senegal,SN +Serbia,RS +Seychelles,SC +Sierra Leone,SL +Singapore,SG +Sint Maarten (Dutch part),SX +Slovakia,SK +Slovenia,SI +Solomon Islands,SB +Somalia,SO +South Africa,ZA +South Georgia and the South Sandwich Islands,GS +South Sudan,SS +Spain,ES +Sri Lanka,LK +Sudan,SD +Suriname,SR +Svalbard and Jan Mayen,SJ +Swaziland,SZ +Sweden,SE +Switzerland,CH +Syrian Arab Republic,SY +"Taiwan, Province of China",TW +Tajikistan,TJ +"Tanzania, United Republic of",TZ +Thailand,TH +Timor-Leste,TL +Togo,TG +Tokelau,TK +Tonga,TO +Trinidad and Tobago,TT +Tunisia,TN +Turkey,TR +Turkmenistan,TM +Turks and Caicos Islands,TC +Tuvalu,TV +Uganda,UG +Ukraine,UA +United Arab Emirates,AE +United Kingdom,GB +United States,US +United States Minor Outlying Islands,UM +Uruguay,UY +Uzbekistan,UZ +Vanuatu,VU +"Venezuela, Bolivarian Republic of",VE +Viet Nam,VN +"Virgin Islands, British",VG +"Virgin Islands, U.S.",VI +Wallis and Futuna,WF +Western Sahara,EH +Yemen,YE +Zambia,ZM +Zimbabwe,ZW diff --git a/tests/fixtures/datahub-country-list/data_csv.csv b/tests/fixtures/datahub-country-list/data_csv.csv new file mode 100644 index 0000000..16c718a --- /dev/null +++ b/tests/fixtures/datahub-country-list/data_csv.csv @@ -0,0 +1,250 @@ +Name,Code +Afghanistan,AF +Åland Islands,AX +Albania,AL +Algeria,DZ +American Samoa,AS +Andorra,AD +Angola,AO +Anguilla,AI +Antarctica,AQ +Antigua and Barbuda,AG +Argentina,AR +Armenia,AM +Aruba,AW +Australia,AU +Austria,AT +Azerbaijan,AZ +Bahamas,BS +Bahrain,BH +Bangladesh,BD +Barbados,BB +Belarus,BY +Belgium,BE +Belize,BZ +Benin,BJ +Bermuda,BM +Bhutan,BT +"Bolivia, Plurinational State of",BO +"Bonaire, Sint Eustatius and Saba",BQ +Bosnia and Herzegovina,BA +Botswana,BW +Bouvet Island,BV +Brazil,BR +British Indian Ocean Territory,IO +Brunei Darussalam,BN +Bulgaria,BG +Burkina Faso,BF +Burundi,BI +Cambodia,KH +Cameroon,CM +Canada,CA +Cape Verde,CV +Cayman Islands,KY +Central African Republic,CF +Chad,TD +Chile,CL +China,CN +Christmas Island,CX +Cocos (Keeling) Islands,CC +Colombia,CO +Comoros,KM +Congo,CG +"Congo, the Democratic Republic of the",CD +Cook Islands,CK +Costa Rica,CR +Côte d'Ivoire,CI +Croatia,HR +Cuba,CU +Curaçao,CW +Cyprus,CY +Czech Republic,CZ +Denmark,DK +Djibouti,DJ +Dominica,DM +Dominican Republic,DO +Ecuador,EC +Egypt,EG +El Salvador,SV +Equatorial Guinea,GQ +Eritrea,ER +Estonia,EE +Ethiopia,ET +Falkland Islands (Malvinas),FK +Faroe Islands,FO +Fiji,FJ +Finland,FI +France,FR +French Guiana,GF +French Polynesia,PF +French Southern Territories,TF +Gabon,GA +Gambia,GM +Georgia,GE +Germany,DE +Ghana,GH +Gibraltar,GI +Greece,GR +Greenland,GL +Grenada,GD +Guadeloupe,GP +Guam,GU +Guatemala,GT +Guernsey,GG +Guinea,GN +Guinea-Bissau,GW +Guyana,GY +Haiti,HT +Heard Island and McDonald Islands,HM +Holy See (Vatican City State),VA +Honduras,HN +Hong Kong,HK +Hungary,HU +Iceland,IS +India,IN +Indonesia,ID +"Iran, Islamic Republic of",IR +Iraq,IQ +Ireland,IE +Isle of Man,IM +Israel,IL +Italy,IT +Jamaica,JM +Japan,JP +Jersey,JE +Jordan,JO +Kazakhstan,KZ +Kenya,KE +Kiribati,KI +"Korea, Democratic People's Republic of",KP +"Korea, Republic of",KR +Kuwait,KW +Kyrgyzstan,KG +Lao People's Democratic Republic,LA +Latvia,LV +Lebanon,LB +Lesotho,LS +Liberia,LR +Libya,LY +Liechtenstein,LI +Lithuania,LT +Luxembourg,LU +Macao,MO +"Macedonia, the Former Yugoslav Republic of",MK +Madagascar,MG +Malawi,MW +Malaysia,MY +Maldives,MV +Mali,ML +Malta,MT +Marshall Islands,MH +Martinique,MQ +Mauritania,MR +Mauritius,MU +Mayotte,YT +Mexico,MX +"Micronesia, Federated States of",FM +"Moldova, Republic of",MD +Monaco,MC +Mongolia,MN +Montenegro,ME +Montserrat,MS +Morocco,MA +Mozambique,MZ +Myanmar,MM +Namibia,NA +Nauru,NR +Nepal,NP +Netherlands,NL +New Caledonia,NC +New Zealand,NZ +Nicaragua,NI +Niger,NE +Nigeria,NG +Niue,NU +Norfolk Island,NF +Northern Mariana Islands,MP +Norway,NO +Oman,OM +Pakistan,PK +Palau,PW +"Palestine, State of",PS +Panama,PA +Papua New Guinea,PG +Paraguay,PY +Peru,PE +Philippines,PH +Pitcairn,PN +Poland,PL +Portugal,PT +Puerto Rico,PR +Qatar,QA +Réunion,RE +Romania,RO +Russian Federation,RU +Rwanda,RW +Saint Barthélemy,BL +"Saint Helena, Ascension and Tristan da Cunha",SH +Saint Kitts and Nevis,KN +Saint Lucia,LC +Saint Martin (French part),MF +Saint Pierre and Miquelon,PM +Saint Vincent and the Grenadines,VC +Samoa,WS +San Marino,SM +Sao Tome and Principe,ST +Saudi Arabia,SA +Senegal,SN +Serbia,RS +Seychelles,SC +Sierra Leone,SL +Singapore,SG +Sint Maarten (Dutch part),SX +Slovakia,SK +Slovenia,SI +Solomon Islands,SB +Somalia,SO +South Africa,ZA +South Georgia and the South Sandwich Islands,GS +South Sudan,SS +Spain,ES +Sri Lanka,LK +Sudan,SD +Suriname,SR +Svalbard and Jan Mayen,SJ +Swaziland,SZ +Sweden,SE +Switzerland,CH +Syrian Arab Republic,SY +"Taiwan, Province of China",TW +Tajikistan,TJ +"Tanzania, United Republic of",TZ +Thailand,TH +Timor-Leste,TL +Togo,TG +Tokelau,TK +Tonga,TO +Trinidad and Tobago,TT +Tunisia,TN +Turkey,TR +Turkmenistan,TM +Turks and Caicos Islands,TC +Tuvalu,TV +Uganda,UG +Ukraine,UA +United Arab Emirates,AE +United Kingdom,GB +United States,US +United States Minor Outlying Islands,UM +Uruguay,UY +Uzbekistan,UZ +Vanuatu,VU +"Venezuela, Bolivarian Republic of",VE +Viet Nam,VN +"Virgin Islands, British",VG +"Virgin Islands, U.S.",VI +Wallis and Futuna,WF +Western Sahara,EH +Yemen,YE +Zambia,ZM +Zimbabwe,ZW diff --git a/tests/fixtures/datahub-country-list/data_json.json b/tests/fixtures/datahub-country-list/data_json.json new file mode 100644 index 0000000..fe16d23 --- /dev/null +++ b/tests/fixtures/datahub-country-list/data_json.json @@ -0,0 +1 @@ +[{"Code": "AF", "Name": "Afghanistan"},{"Code": "AX", "Name": "\u00c5land Islands"},{"Code": "AL", "Name": "Albania"},{"Code": "DZ", "Name": "Algeria"},{"Code": "AS", "Name": "American Samoa"},{"Code": "AD", "Name": "Andorra"},{"Code": "AO", "Name": "Angola"},{"Code": "AI", "Name": "Anguilla"},{"Code": "AQ", "Name": "Antarctica"},{"Code": "AG", "Name": "Antigua and Barbuda"},{"Code": "AR", "Name": "Argentina"},{"Code": "AM", "Name": "Armenia"},{"Code": "AW", "Name": "Aruba"},{"Code": "AU", "Name": "Australia"},{"Code": "AT", "Name": "Austria"},{"Code": "AZ", "Name": "Azerbaijan"},{"Code": "BS", "Name": "Bahamas"},{"Code": "BH", "Name": "Bahrain"},{"Code": "BD", "Name": "Bangladesh"},{"Code": "BB", "Name": "Barbados"},{"Code": "BY", "Name": "Belarus"},{"Code": "BE", "Name": "Belgium"},{"Code": "BZ", "Name": "Belize"},{"Code": "BJ", "Name": "Benin"},{"Code": "BM", "Name": "Bermuda"},{"Code": "BT", "Name": "Bhutan"},{"Code": "BO", "Name": "Bolivia, Plurinational State of"},{"Code": "BQ", "Name": "Bonaire, Sint Eustatius and Saba"},{"Code": "BA", "Name": "Bosnia and Herzegovina"},{"Code": "BW", "Name": "Botswana"},{"Code": "BV", "Name": "Bouvet Island"},{"Code": "BR", "Name": "Brazil"},{"Code": "IO", "Name": "British Indian Ocean Territory"},{"Code": "BN", "Name": "Brunei Darussalam"},{"Code": "BG", "Name": "Bulgaria"},{"Code": "BF", "Name": "Burkina Faso"},{"Code": "BI", "Name": "Burundi"},{"Code": "KH", "Name": "Cambodia"},{"Code": "CM", "Name": "Cameroon"},{"Code": "CA", "Name": "Canada"},{"Code": "CV", "Name": "Cape Verde"},{"Code": "KY", "Name": "Cayman Islands"},{"Code": "CF", "Name": "Central African Republic"},{"Code": "TD", "Name": "Chad"},{"Code": "CL", "Name": "Chile"},{"Code": "CN", "Name": "China"},{"Code": "CX", "Name": "Christmas Island"},{"Code": "CC", "Name": "Cocos (Keeling) Islands"},{"Code": "CO", "Name": "Colombia"},{"Code": "KM", "Name": "Comoros"},{"Code": "CG", "Name": "Congo"},{"Code": "CD", "Name": "Congo, the Democratic Republic of the"},{"Code": "CK", "Name": "Cook Islands"},{"Code": "CR", "Name": "Costa Rica"},{"Code": "CI", "Name": "C\u00f4te d'Ivoire"},{"Code": "HR", "Name": "Croatia"},{"Code": "CU", "Name": "Cuba"},{"Code": "CW", "Name": "Cura\u00e7ao"},{"Code": "CY", "Name": "Cyprus"},{"Code": "CZ", "Name": "Czech Republic"},{"Code": "DK", "Name": "Denmark"},{"Code": "DJ", "Name": "Djibouti"},{"Code": "DM", "Name": "Dominica"},{"Code": "DO", "Name": "Dominican Republic"},{"Code": "EC", "Name": "Ecuador"},{"Code": "EG", "Name": "Egypt"},{"Code": "SV", "Name": "El Salvador"},{"Code": "GQ", "Name": "Equatorial Guinea"},{"Code": "ER", "Name": "Eritrea"},{"Code": "EE", "Name": "Estonia"},{"Code": "ET", "Name": "Ethiopia"},{"Code": "FK", "Name": "Falkland Islands (Malvinas)"},{"Code": "FO", "Name": "Faroe Islands"},{"Code": "FJ", "Name": "Fiji"},{"Code": "FI", "Name": "Finland"},{"Code": "FR", "Name": "France"},{"Code": "GF", "Name": "French Guiana"},{"Code": "PF", "Name": "French Polynesia"},{"Code": "TF", "Name": "French Southern Territories"},{"Code": "GA", "Name": "Gabon"},{"Code": "GM", "Name": "Gambia"},{"Code": "GE", "Name": "Georgia"},{"Code": "DE", "Name": "Germany"},{"Code": "GH", "Name": "Ghana"},{"Code": "GI", "Name": "Gibraltar"},{"Code": "GR", "Name": "Greece"},{"Code": "GL", "Name": "Greenland"},{"Code": "GD", "Name": "Grenada"},{"Code": "GP", "Name": "Guadeloupe"},{"Code": "GU", "Name": "Guam"},{"Code": "GT", "Name": "Guatemala"},{"Code": "GG", "Name": "Guernsey"},{"Code": "GN", "Name": "Guinea"},{"Code": "GW", "Name": "Guinea-Bissau"},{"Code": "GY", "Name": "Guyana"},{"Code": "HT", "Name": "Haiti"},{"Code": "HM", "Name": "Heard Island and McDonald Islands"},{"Code": "VA", "Name": "Holy See (Vatican City State)"},{"Code": "HN", "Name": "Honduras"},{"Code": "HK", "Name": "Hong Kong"},{"Code": "HU", "Name": "Hungary"},{"Code": "IS", "Name": "Iceland"},{"Code": "IN", "Name": "India"},{"Code": "ID", "Name": "Indonesia"},{"Code": "IR", "Name": "Iran, Islamic Republic of"},{"Code": "IQ", "Name": "Iraq"},{"Code": "IE", "Name": "Ireland"},{"Code": "IM", "Name": "Isle of Man"},{"Code": "IL", "Name": "Israel"},{"Code": "IT", "Name": "Italy"},{"Code": "JM", "Name": "Jamaica"},{"Code": "JP", "Name": "Japan"},{"Code": "JE", "Name": "Jersey"},{"Code": "JO", "Name": "Jordan"},{"Code": "KZ", "Name": "Kazakhstan"},{"Code": "KE", "Name": "Kenya"},{"Code": "KI", "Name": "Kiribati"},{"Code": "KP", "Name": "Korea, Democratic People's Republic of"},{"Code": "KR", "Name": "Korea, Republic of"},{"Code": "KW", "Name": "Kuwait"},{"Code": "KG", "Name": "Kyrgyzstan"},{"Code": "LA", "Name": "Lao People's Democratic Republic"},{"Code": "LV", "Name": "Latvia"},{"Code": "LB", "Name": "Lebanon"},{"Code": "LS", "Name": "Lesotho"},{"Code": "LR", "Name": "Liberia"},{"Code": "LY", "Name": "Libya"},{"Code": "LI", "Name": "Liechtenstein"},{"Code": "LT", "Name": "Lithuania"},{"Code": "LU", "Name": "Luxembourg"},{"Code": "MO", "Name": "Macao"},{"Code": "MK", "Name": "Macedonia, the Former Yugoslav Republic of"},{"Code": "MG", "Name": "Madagascar"},{"Code": "MW", "Name": "Malawi"},{"Code": "MY", "Name": "Malaysia"},{"Code": "MV", "Name": "Maldives"},{"Code": "ML", "Name": "Mali"},{"Code": "MT", "Name": "Malta"},{"Code": "MH", "Name": "Marshall Islands"},{"Code": "MQ", "Name": "Martinique"},{"Code": "MR", "Name": "Mauritania"},{"Code": "MU", "Name": "Mauritius"},{"Code": "YT", "Name": "Mayotte"},{"Code": "MX", "Name": "Mexico"},{"Code": "FM", "Name": "Micronesia, Federated States of"},{"Code": "MD", "Name": "Moldova, Republic of"},{"Code": "MC", "Name": "Monaco"},{"Code": "MN", "Name": "Mongolia"},{"Code": "ME", "Name": "Montenegro"},{"Code": "MS", "Name": "Montserrat"},{"Code": "MA", "Name": "Morocco"},{"Code": "MZ", "Name": "Mozambique"},{"Code": "MM", "Name": "Myanmar"},{"Code": "NA", "Name": "Namibia"},{"Code": "NR", "Name": "Nauru"},{"Code": "NP", "Name": "Nepal"},{"Code": "NL", "Name": "Netherlands"},{"Code": "NC", "Name": "New Caledonia"},{"Code": "NZ", "Name": "New Zealand"},{"Code": "NI", "Name": "Nicaragua"},{"Code": "NE", "Name": "Niger"},{"Code": "NG", "Name": "Nigeria"},{"Code": "NU", "Name": "Niue"},{"Code": "NF", "Name": "Norfolk Island"},{"Code": "MP", "Name": "Northern Mariana Islands"},{"Code": "NO", "Name": "Norway"},{"Code": "OM", "Name": "Oman"},{"Code": "PK", "Name": "Pakistan"},{"Code": "PW", "Name": "Palau"},{"Code": "PS", "Name": "Palestine, State of"},{"Code": "PA", "Name": "Panama"},{"Code": "PG", "Name": "Papua New Guinea"},{"Code": "PY", "Name": "Paraguay"},{"Code": "PE", "Name": "Peru"},{"Code": "PH", "Name": "Philippines"},{"Code": "PN", "Name": "Pitcairn"},{"Code": "PL", "Name": "Poland"},{"Code": "PT", "Name": "Portugal"},{"Code": "PR", "Name": "Puerto Rico"},{"Code": "QA", "Name": "Qatar"},{"Code": "RE", "Name": "R\u00e9union"},{"Code": "RO", "Name": "Romania"},{"Code": "RU", "Name": "Russian Federation"},{"Code": "RW", "Name": "Rwanda"},{"Code": "BL", "Name": "Saint Barth\u00e9lemy"},{"Code": "SH", "Name": "Saint Helena, Ascension and Tristan da Cunha"},{"Code": "KN", "Name": "Saint Kitts and Nevis"},{"Code": "LC", "Name": "Saint Lucia"},{"Code": "MF", "Name": "Saint Martin (French part)"},{"Code": "PM", "Name": "Saint Pierre and Miquelon"},{"Code": "VC", "Name": "Saint Vincent and the Grenadines"},{"Code": "WS", "Name": "Samoa"},{"Code": "SM", "Name": "San Marino"},{"Code": "ST", "Name": "Sao Tome and Principe"},{"Code": "SA", "Name": "Saudi Arabia"},{"Code": "SN", "Name": "Senegal"},{"Code": "RS", "Name": "Serbia"},{"Code": "SC", "Name": "Seychelles"},{"Code": "SL", "Name": "Sierra Leone"},{"Code": "SG", "Name": "Singapore"},{"Code": "SX", "Name": "Sint Maarten (Dutch part)"},{"Code": "SK", "Name": "Slovakia"},{"Code": "SI", "Name": "Slovenia"},{"Code": "SB", "Name": "Solomon Islands"},{"Code": "SO", "Name": "Somalia"},{"Code": "ZA", "Name": "South Africa"},{"Code": "GS", "Name": "South Georgia and the South Sandwich Islands"},{"Code": "SS", "Name": "South Sudan"},{"Code": "ES", "Name": "Spain"},{"Code": "LK", "Name": "Sri Lanka"},{"Code": "SD", "Name": "Sudan"},{"Code": "SR", "Name": "Suriname"},{"Code": "SJ", "Name": "Svalbard and Jan Mayen"},{"Code": "SZ", "Name": "Swaziland"},{"Code": "SE", "Name": "Sweden"},{"Code": "CH", "Name": "Switzerland"},{"Code": "SY", "Name": "Syrian Arab Republic"},{"Code": "TW", "Name": "Taiwan, Province of China"},{"Code": "TJ", "Name": "Tajikistan"},{"Code": "TZ", "Name": "Tanzania, United Republic of"},{"Code": "TH", "Name": "Thailand"},{"Code": "TL", "Name": "Timor-Leste"},{"Code": "TG", "Name": "Togo"},{"Code": "TK", "Name": "Tokelau"},{"Code": "TO", "Name": "Tonga"},{"Code": "TT", "Name": "Trinidad and Tobago"},{"Code": "TN", "Name": "Tunisia"},{"Code": "TR", "Name": "Turkey"},{"Code": "TM", "Name": "Turkmenistan"},{"Code": "TC", "Name": "Turks and Caicos Islands"},{"Code": "TV", "Name": "Tuvalu"},{"Code": "UG", "Name": "Uganda"},{"Code": "UA", "Name": "Ukraine"},{"Code": "AE", "Name": "United Arab Emirates"},{"Code": "GB", "Name": "United Kingdom"},{"Code": "US", "Name": "United States"},{"Code": "UM", "Name": "United States Minor Outlying Islands"},{"Code": "UY", "Name": "Uruguay"},{"Code": "UZ", "Name": "Uzbekistan"},{"Code": "VU", "Name": "Vanuatu"},{"Code": "VE", "Name": "Venezuela, Bolivarian Republic of"},{"Code": "VN", "Name": "Viet Nam"},{"Code": "VG", "Name": "Virgin Islands, British"},{"Code": "VI", "Name": "Virgin Islands, U.S."},{"Code": "WF", "Name": "Wallis and Futuna"},{"Code": "EH", "Name": "Western Sahara"},{"Code": "YE", "Name": "Yemen"},{"Code": "ZM", "Name": "Zambia"},{"Code": "ZW", "Name": "Zimbabwe"}] \ No newline at end of file diff --git a/tests/fixtures/datahub-country-list/datapackage.json b/tests/fixtures/datahub-country-list/datapackage.json new file mode 100644 index 0000000..5ac6ee1 --- /dev/null +++ b/tests/fixtures/datahub-country-list/datapackage.json @@ -0,0 +1,154 @@ +{ + "datahub": { + "findability": "published", + "hash": "2f0f383b6b82a6825432c7768c644c5f", + "modified": "2017-11-15T07:58:19.911281", + "owner": "core", + "ownerid": "core", + "stats": { + "bytes": 25647, + "rowcount": 249 + } + }, + "id": "core/country-list", + "license": "ODC-PDDL", + "name": "country-list", + "profile": "data-package", + "readme": "ISO 3166-1-alpha-2 English country names and code elements. This list states\nthe country names (official short names in English) in alphabetical order as\ngiven in [ISO 3166-1][] and the corresponding ISO 3166-1-alpha-2 code elements.\n\n[ISO 3166-1]: http://www.iso.org/iso/home/standards/country_codes.htm\n\nThis list is updated whenever a change to the official code list in ISO 3166-1\nis effected by the ISO 3166/MA.\n\nIt lists 250 official short names and code elements as of Dec 2012.\n\n## License\n\nThis material is licensed by its maintainers under the Public Domain Dedication\nand License.\n\nNevertheless, it should be noted that this material is ultimately sourced from\nISO and their rights and licensing policy is somewhat unclear. As this is a\nshort, simple database of facts there is a strong argument that no rights can\nsubsist in this collection. However, ISO state on [their\nsite](http://www.iso.org/iso/home/standards/country_codes.htm): \n\n> ISO makes the list of alpha-2 country codes available for internal use and\n> non-commercial purposes free of charge. \n\nThis carries the implication (though not spelled out) that other uses are not\npermitted and that, therefore, there may be rights preventing further general\nuse and reuse.\n\n", + "resources": [ + { + "bytes": 4120, + "datahub": { + "derivedFrom": [ + "data" + ], + "type": "derived/csv" + }, + "dialect": { + "delimiter": ",", + "doubleQuote": true, + "lineTerminator": "\r\n", + "quoteChar": "\"", + "skipInitialSpace": false + }, + "dpp:streamedFrom": "https://s3.amazonaws.com/rawstore.datahub.io/d7c9d7cfb42cb69f4422dec222dbbaa8.csv", + "encoding": "utf-8", + "format": "csv", + "hash": "d7c9d7cfb42cb69f4422dec222dbbaa8", + "name": "data_csv", + "path": "data_csv.csv", + "primaryKey": "Code", + "profile": "data-resource", + "rowcount": 249, + "schema": { + "fields": [ + { + "description": "Country Name", + "name": "Name", + "type": "string" + }, + { + "description": "ISO 2-digit code from ISO 3166-alpha-2", + "name": "Code", + "type": "string" + } + ] + } + }, + { + "bytes": 9576, + "datahub": { + "derivedFrom": [ + "data" + ], + "type": "derived/json" + }, + "dpp:streamedFrom": "https://s3.amazonaws.com/rawstore.datahub.io/d7c9d7cfb42cb69f4422dec222dbbaa8.csv", + "encoding": "utf-8", + "format": "json", + "hash": "8c458f2d15d9f2119654b29ede6e45b8", + "name": "data_json", + "path": "data_json.json", + "primaryKey": "Code", + "profile": "data-resource", + "rowcount": 249, + "schema": { + "fields": [ + { + "description": "Country Name", + "name": "Name", + "type": "string" + }, + { + "description": "ISO 2-digit code from ISO 3166-alpha-2", + "name": "Code", + "type": "string" + } + ] + } + }, + { + "bytes": 8081, + "datahub": { + "type": "derived/zip" + }, + "description": "Compressed versions of dataset. Includes normalized CSV and JSON data with original data and datapackage.json.", + "dpp:streamedFrom": "/tmp/core.country-list.2.zip", + "encoding": "utf-8", + "format": "zip", + "name": "datapackage_zip", + "path": "datapackage_zip.zip", + "profile": "data-resource" + }, + { + "bytes": 3870, + "datahub": { + "type": "source/tabular" + }, + "dpp:streamedFrom": "https://s3.amazonaws.com/rawstore.datahub.io/d7c9d7cfb42cb69f4422dec222dbbaa8.csv", + "encoding": "utf-8", + "format": "csv", + "name": "data", + "path": "data.csv", + "primaryKey": "Code", + "profile": "data-resource", + "schema": { + "fields": [ + { + "description": "Country Name", + "name": "Name", + "type": "string" + }, + { + "description": "ISO 2-digit code from ISO 3166-alpha-2", + "name": "Code", + "type": "string" + } + ] + } + } + ], + "sources": [ + { + "name": "ISO", + "path": "http://www.iso.org/iso/home/standards/country_codes.htm", + "title": "ISO" + } + ], + "title": "List of all countries with their 2 digit codes (ISO 3166-2)", + "views": [ + { + "datahub": { + "type": "preview" + }, + "name": "datahub-preview-data_csv_preview", + "resources": [ + "data" + ], + "specType": "table", + "transform": { + "limit": 2000 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/datahub-country-list/datapackage_zip.zip b/tests/fixtures/datahub-country-list/datapackage_zip.zip new file mode 100644 index 0000000..0c350a3 Binary files /dev/null and b/tests/fixtures/datahub-country-list/datapackage_zip.zip differ diff --git a/tests/fixtures/fiscal-datapackage/datapackage.json b/tests/fixtures/fiscal-datapackage/datapackage.json index e788856..12effa0 100644 --- a/tests/fixtures/fiscal-datapackage/datapackage.json +++ b/tests/fixtures/fiscal-datapackage/datapackage.json @@ -1,12 +1,12 @@ { "name": "my-openspending-datapackage", "title": "My OpenSpending Data Package", - "profile": "fiscal-data-package", + "profile": "tabular-data-package", "resources": [ { "name": "budget", "title": "Budget", - "profile": "data-resource", + "profile": "tabular-data-resource", "path": ["budget.csv"], "schema": { "fields": [ @@ -43,7 +43,7 @@ { "name": "entities", "title": "Entities", - "profile": "data-resource", + "profile": "tabular-data-resource", "path": ["entities.csv"], "schema": { "fields": [