Skip to content

Commit

Permalink
upgrade tableschema dependency, update specs
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Nov 21, 2017
1 parent c045648 commit 829ea12
Show file tree
Hide file tree
Showing 18 changed files with 1,319 additions and 1,123 deletions.
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions src/Validators/schemas/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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'
184 changes: 66 additions & 118 deletions src/Validators/schemas/data-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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": {
Expand All @@ -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": {
Expand All @@ -150,7 +119,7 @@
]
},
"organisation": {
"title": "Organisation",
"title": "Organization",
"description": "An organizational affiliation for this contributor.",
"type": "string"
},
Expand All @@ -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\": \"[email protected]\",\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\": \"[email protected]\",\n \"role\": \"author\"\n }\n ]\n}\n"
]
},
"keywords": {
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
Loading

0 comments on commit 829ea12

Please sign in to comment.