Skip to content

Commit 1443327

Browse files
Merge pull request #67 from courtney-miles/issue/66/UpdateTableSchemaSchema
Fixes #66 : Update table-schema.json
2 parents d1e1f61 + 779cc6e commit 1443327

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

src/schemas/CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@
77
* name field is not limited with regexp ( it used to be limited with ^([-a-z0-9._/])+$ )
88
* added bareNumber attribute to number and integer field types - 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.
99
* removed currency attribute from number field types
10+
11+
12+
2022-01-17T11:00:57+00:00
13+
* allow table schema to be set to string, to allow a path to a schema
14+
* removed pattern constraint for the types number, integer, yearmonth,
15+
* add format to boolean type, which may only be set to default
16+
* add example for missingValue to illustrate setting it to an empty array

src/schemas/table-schema.json

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
"$schema": "http://json-schema.org/draft-04/schema#",
33
"title": "Table Schema",
44
"description": "A Table Schema for this resource, compliant with the [Table Schema](/tableschema/) specification.",
5-
"type": "object",
5+
"type": [
6+
"string",
7+
"object"
8+
],
69
"required": [
710
"fields"
811
],
@@ -180,11 +183,6 @@
180183
"type": "boolean",
181184
"description": "When `true`, each value for the property `MUST` be unique."
182185
},
183-
"pattern": {
184-
"type": "string",
185-
"description": "A regular expression pattern to test each value of the property against, where a truthy response indicates validity.",
186-
"context": "Regular expressions `SHOULD` conform to the [XML Schema regular expression syntax](http://www.w3.org/TR/xmlschema-2/#regexs)."
187-
},
188186
"enum": {
189187
"oneOf": [
190188
{
@@ -301,11 +299,6 @@
301299
"type": "boolean",
302300
"description": "When `true`, each value for the property `MUST` be unique."
303301
},
304-
"pattern": {
305-
"type": "string",
306-
"description": "A regular expression pattern to test each value of the property against, where a truthy response indicates validity.",
307-
"context": "Regular expressions `SHOULD` conform to the [XML Schema regular expression syntax](http://www.w3.org/TR/xmlschema-2/#regexs)."
308-
},
309302
"enum": {
310303
"oneOf": [
311304
{
@@ -767,11 +760,6 @@
767760
"type": "boolean",
768761
"description": "When `true`, each value for the property `MUST` be unique."
769762
},
770-
"pattern": {
771-
"type": "string",
772-
"description": "A regular expression pattern to test each value of the property against, where a truthy response indicates validity.",
773-
"context": "Regular expressions `SHOULD` conform to the [XML Schema regular expression syntax](http://www.w3.org/TR/xmlschema-2/#regexs)."
774-
},
775763
"enum": {
776764
"type": "array",
777765
"minItems": 1,
@@ -834,6 +822,13 @@
834822
"boolean"
835823
]
836824
},
825+
"format": {
826+
"description": "There are no format keyword options for `boolean`: only `default` is allowed.",
827+
"enum": [
828+
"default"
829+
],
830+
"default": "default"
831+
},
837832
"trueValues": {
838833
"type": "array",
839834
"minItems": 1,
@@ -1549,7 +1544,8 @@
15491544
"description": "Values that when encountered in the source, should be considered as `null`, 'not present', or 'blank' values.",
15501545
"context": "Many datasets arrive with missing data values, either because a value was not collected or it never existed.\nMissing values may be indicated simply by the value being empty in other cases a special value may have been used e.g. `-`, `NaN`, `0`, `-9999` etc.\nThe `missingValues` property provides a way to indicate that these values should be interpreted as equivalent to null.\n\n`missingValues` are strings rather than being the data type of the particular field. This allows for comparison prior to casting and for fields to have missing value which are not of their type, for example a `number` field to have missing values indicated by `-`.\n\nThe default value of `missingValue` for a non-string type field is the empty string `''`. For string type fields there is no default for `missingValue` (for string fields the empty string `''` is a valid value and need not indicate null).",
15511546
"examples": [
1552-
"{\n \"missingValues\": [\n \"-\",\n \"NaN\",\n \"\"\n ]\n}\n"
1547+
"{\n \"missingValues\": [\n \"-\",\n \"NaN\",\n \"\"\n ]\n}\n",
1548+
"{\n \"missingValues\": []\n}\n"
15531549
]
15541550
}
15551551
},

tests/SchemaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function provideInvalidDescriptors(): array
199199
{
200200
return [
201201
[
202-
'[] Array value found, but an object is required',
202+
'[] Array value found, but a string or an object is required',
203203
[],
204204
],
205205
[

0 commit comments

Comments
 (0)