Skip to content

Commit 829ea12

Browse files
committed
upgrade tableschema dependency, update specs
1 parent c045648 commit 829ea12

18 files changed

+1319
-1123
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,18 @@ you need to manually install it, then you can run : `composer style-check` or `c
6767
The json schemas for the frictionlessdata specs are stored locally as part of the package.
6868

6969
They might change from time to time, to donwnload the latest specs run `composer update_registry`
70+
71+
## Testing with a local copy of tableschema-php
72+
73+
Add the following to `composer.json`
74+
75+
```
76+
"repositories": [
77+
{
78+
"type": "path",
79+
"url": "../tableschema-php"
80+
}
81+
]
82+
```
83+
84+
Run `composer update`

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"require": {
66
"php": ">=5.4",
77
"justinrainbow/json-schema": "^5.2",
8-
"frictionlessdata/tableschema": "^0.1.6",
8+
"frictionlessdata/tableschema": "^0.1.7",
99
"alchemy/zippy": "=0.3.5"
1010
},
1111
"require-dev": {

src/Package.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
class Package
66
{
7-
public static function load($source, $basePath = null)
7+
public static function load($source, $basePath = null, $options = null)
88
{
9-
return Factory::datapackage($source, $basePath);
9+
return Factory::datapackage($source, $basePath, $options);
1010
}
1111

1212
public static function validate($source, $basePath = null)

src/Validators/schemas/CHANGELOG

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,17 @@
66
* changed role enum
77
* data attribute changed to path which can be either a single string or array of strings
88
* changes to table-schema (not affecting datapackage directly)
9+
10+
2017-11-21T20:55:19+02:00
11+
12+
* added schemas from registry: data-resource, tabular-data-resource
13+
* default profile changed from 'default' to 'data-package'
14+
* homepage type changed from 'object' to 'string' with format 'uri'
15+
* changed contributor 'name' attribute to 'title'
16+
* added default contributor role - 'contributor'
17+
* added image attribute - an image to represent the data package (string)
18+
* license name - must be an Open Definition license identifier - "^([-a-zA-Z0-9._])+$"
19+
* resource must have either one of "data" or "path" attribute (but not both)
20+
* default resource profile changed from 'default' to 'data-resource'
21+
* added 'data' - Inline data for this resource
22+
* changed source 'name' attribute to 'title'

src/Validators/schemas/data-package.json

Lines changed: 66 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
],
99
"properties": {
1010
"profile": {
11+
"default": "data-package",
1112
"propertyOrder": 10,
1213
"title": "Profile",
1314
"description": "The profile of this descriptor.",
14-
"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.",
15+
"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.",
1516
"type": "string",
16-
"default": "default",
1717
"examples": [
1818
"{\n \"profile\": \"tabular-data-package\"\n}\n",
1919
"{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n"
@@ -64,39 +64,10 @@
6464
"propertyOrder": 60,
6565
"title": "Home Page",
6666
"description": "The home on the web that is related to this data package.",
67-
"type": "object",
68-
"properties": {
69-
"name": {
70-
"title": "Name",
71-
"description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.",
72-
"type": "string",
73-
"pattern": "^([-a-z0-9._/])+$",
74-
"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.",
75-
"examples": [
76-
"{\n \"name\": \"my-nice-name\"\n}\n"
77-
]
78-
},
79-
"path": {
80-
"title": "Path",
81-
"description": "A fully qualified URL, or a POSIX file path..",
82-
"type": "string",
83-
"examples": [
84-
"{\n \"path\": \"file.csv\"\n}\n",
85-
"{\n \"path\": \"http://example.com/file.csv\"\n}\n"
86-
],
87-
"context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly."
88-
},
89-
"title": {
90-
"title": "Title",
91-
"description": "A human-readable title.",
92-
"type": "string",
93-
"examples": [
94-
"{\n \"title\": \"My Package Title\"\n}\n"
95-
]
96-
}
97-
},
67+
"type": "string",
68+
"format": "uri",
9869
"examples": [
99-
"{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n"
70+
"{\n \"homepage\": \"http://example.com/\"\n}\n"
10071
]
10172
},
10273
"created": {
@@ -120,14 +91,12 @@
12091
"title": "Contributor",
12192
"description": "A contributor to this descriptor.",
12293
"properties": {
123-
"name": {
124-
"title": "Name",
125-
"description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.",
94+
"title": {
95+
"title": "Title",
96+
"description": "A human-readable title.",
12697
"type": "string",
127-
"pattern": "^([-a-z0-9._/])+$",
128-
"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.",
12998
"examples": [
130-
"{\n \"name\": \"my-nice-name\"\n}\n"
99+
"{\n \"title\": \"My Package Title\"\n}\n"
131100
]
132101
},
133102
"path": {
@@ -150,7 +119,7 @@
150119
]
151120
},
152121
"organisation": {
153-
"title": "Organisation",
122+
"title": "Organization",
154123
"description": "An organizational affiliation for this contributor.",
155124
"type": "string"
156125
},
@@ -162,17 +131,18 @@
162131
"maintainer",
163132
"wrangler",
164133
"contributor"
165-
]
134+
],
135+
"default": "contributor"
166136
}
167137
},
168138
"required": [
169-
"name"
139+
"title"
170140
],
171141
"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."
172142
},
173143
"examples": [
174-
"{\n \"contributors\": [\n {\n \"name\": \"Joe Bloggs\"\n }\n ]\n}\n",
175-
"{\n \"contributors\": [\n {\n \"name\": \"Joe Bloggs\",\n \"email\": \"joe@example.com\",\n \"role\": \"author\"\n }\n ]\n}\n"
144+
"{\n \"contributors\": [\n {\n \"title\": \"Joe Bloggs\"\n }\n ]\n}\n",
145+
"{\n \"contributors\": [\n {\n \"title\": \"Joe Bloggs\",\n \"email\": \"joe@example.com\",\n \"role\": \"author\"\n }\n ]\n}\n"
176146
]
177147
},
178148
"keywords": {
@@ -188,8 +158,18 @@
188158
"{\n \"keywords\": [\n \"data\",\n \"fiscal\",\n \"transparency\"\n ]\n}\n"
189159
]
190160
},
191-
"licenses": {
161+
"image": {
192162
"propertyOrder": 100,
163+
"title": "Image",
164+
"description": "A image to represent this package.",
165+
"type": "string",
166+
"examples": [
167+
"{\n \"image\": \"http://example.com/image.jpg\"\n}\n",
168+
"{\n \"image\": \"relative/to/image.jpg\"\n}\n"
169+
]
170+
},
171+
"licenses": {
172+
"propertyOrder": 110,
193173
"title": "Licenses",
194174
"description": "The license(s) under which this package is published.",
195175
"type": "array",
@@ -198,19 +178,12 @@
198178
"title": "License",
199179
"description": "A license for this descriptor.",
200180
"type": "object",
201-
"required": [
202-
"uri"
203-
],
204181
"properties": {
205182
"name": {
206-
"title": "Name",
207-
"description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.",
183+
"title": "Open Definition license identifier",
184+
"description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/",
208185
"type": "string",
209-
"pattern": "^([-a-z0-9._/])+$",
210-
"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.",
211-
"examples": [
212-
"{\n \"name\": \"my-nice-name\"\n}\n"
213-
]
186+
"pattern": "^([-a-zA-Z0-9._])+$"
214187
},
215188
"path": {
216189
"title": "Path",
@@ -239,7 +212,7 @@
239212
]
240213
},
241214
"resources": {
242-
"propertyOrder": 110,
215+
"propertyOrder": 120,
243216
"title": "Data Resources",
244217
"description": "An `array` of Data Resource objects, each compliant with the [Data Resource](/data-resource/) specification.",
245218
"type": "array",
@@ -248,18 +221,28 @@
248221
"title": "Data Resource",
249222
"description": "Data Resource.",
250223
"type": "object",
251-
"required": [
252-
"name",
253-
"path"
224+
"oneOf": [
225+
{
226+
"required": [
227+
"name",
228+
"data"
229+
]
230+
},
231+
{
232+
"required": [
233+
"name",
234+
"path"
235+
]
236+
}
254237
],
255238
"properties": {
256239
"profile": {
257240
"propertyOrder": 10,
241+
"default": "data-resource",
258242
"title": "Profile",
259243
"description": "The profile of this descriptor.",
260-
"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.",
244+
"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.",
261245
"type": "string",
262-
"default": "default",
263246
"examples": [
264247
"{\n \"profile\": \"tabular-data-package\"\n}\n",
265248
"{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n"
@@ -317,6 +300,11 @@
317300
"{\n \"path\": \"http://example.com/file.csv\"\n}\n"
318301
]
319302
},
303+
"data": {
304+
"propertyOrder": 230,
305+
"title": "Data",
306+
"description": "Inline data for this resource."
307+
},
320308
"schema": {
321309
"propertyOrder": 40,
322310
"title": "Schema",
@@ -346,39 +334,10 @@
346334
"propertyOrder": 70,
347335
"title": "Home Page",
348336
"description": "The home on the web that is related to this data package.",
349-
"type": "object",
350-
"properties": {
351-
"name": {
352-
"title": "Name",
353-
"description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.",
354-
"type": "string",
355-
"pattern": "^([-a-z0-9._/])+$",
356-
"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.",
357-
"examples": [
358-
"{\n \"name\": \"my-nice-name\"\n}\n"
359-
]
360-
},
361-
"path": {
362-
"title": "Path",
363-
"description": "A fully qualified URL, or a POSIX file path..",
364-
"type": "string",
365-
"examples": [
366-
"{\n \"path\": \"file.csv\"\n}\n",
367-
"{\n \"path\": \"http://example.com/file.csv\"\n}\n"
368-
],
369-
"context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly."
370-
},
371-
"title": {
372-
"title": "Title",
373-
"description": "A human-readable title.",
374-
"type": "string",
375-
"examples": [
376-
"{\n \"title\": \"My Package Title\"\n}\n"
377-
]
378-
}
379-
},
337+
"type": "string",
338+
"format": "uri",
380339
"examples": [
381-
"{\n \"homepage\": {\n \"name\": \"My Web Page\",\n \"uri\": \"http://example.com/\"\n }\n}\n"
340+
"{\n \"homepage\": \"http://example.com/\"\n}\n"
382341
]
383342
},
384343
"sources": {
@@ -395,17 +354,15 @@
395354
"description": "A source file.",
396355
"type": "object",
397356
"required": [
398-
"uri"
357+
"title"
399358
],
400359
"properties": {
401-
"name": {
402-
"title": "Name",
403-
"description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.",
360+
"title": {
361+
"title": "Title",
362+
"description": "A human-readable title.",
404363
"type": "string",
405-
"pattern": "^([-a-z0-9._/])+$",
406-
"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.",
407364
"examples": [
408-
"{\n \"name\": \"my-nice-name\"\n}\n"
365+
"{\n \"title\": \"My Package Title\"\n}\n"
409366
]
410367
},
411368
"path": {
@@ -446,19 +403,12 @@
446403
"title": "License",
447404
"description": "A license for this descriptor.",
448405
"type": "object",
449-
"required": [
450-
"uri"
451-
],
452406
"properties": {
453407
"name": {
454-
"title": "Name",
455-
"description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.",
408+
"title": "Open Definition license identifier",
409+
"description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/",
456410
"type": "string",
457-
"pattern": "^([-a-z0-9._/])+$",
458-
"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.",
459-
"examples": [
460-
"{\n \"name\": \"my-nice-name\"\n}\n"
461-
]
411+
"pattern": "^([-a-zA-Z0-9._])+$"
462412
},
463413
"path": {
464414
"title": "Path",
@@ -562,17 +512,15 @@
562512
"description": "A source file.",
563513
"type": "object",
564514
"required": [
565-
"uri"
515+
"title"
566516
],
567517
"properties": {
568-
"name": {
569-
"title": "Name",
570-
"description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.",
518+
"title": {
519+
"title": "Title",
520+
"description": "A human-readable title.",
571521
"type": "string",
572-
"pattern": "^([-a-z0-9._/])+$",
573-
"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.",
574522
"examples": [
575-
"{\n \"name\": \"my-nice-name\"\n}\n"
523+
"{\n \"title\": \"My Package Title\"\n}\n"
576524
]
577525
},
578526
"path": {

0 commit comments

Comments
 (0)