Skip to content

Commit

Permalink
Merge pull request #67 from courtney-miles/issue/66/UpdateTableSchema…
Browse files Browse the repository at this point in the history
…Schema

Fixes #66 : Update table-schema.json
  • Loading branch information
courtney-miles authored Jan 17, 2022
2 parents d1e1f61 + 779cc6e commit 1443327
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
7 changes: 7 additions & 0 deletions src/schemas/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@
* name field is not limited with regexp ( it used to be limited with ^([-a-z0-9._/])+$ )
* 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.
* removed currency attribute from number field types


2022-01-17T11:00:57+00:00
* allow table schema to be set to string, to allow a path to a schema
* removed pattern constraint for the types number, integer, yearmonth,
* add format to boolean type, which may only be set to default
* add example for missingValue to illustrate setting it to an empty array
30 changes: 13 additions & 17 deletions src/schemas/table-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Table Schema",
"description": "A Table Schema for this resource, compliant with the [Table Schema](/tableschema/) specification.",
"type": "object",
"type": [
"string",
"object"
],
"required": [
"fields"
],
Expand Down Expand Up @@ -180,11 +183,6 @@
"type": "boolean",
"description": "When `true`, each value for the property `MUST` be unique."
},
"pattern": {
"type": "string",
"description": "A regular expression pattern to test each value of the property against, where a truthy response indicates validity.",
"context": "Regular expressions `SHOULD` conform to the [XML Schema regular expression syntax](http://www.w3.org/TR/xmlschema-2/#regexs)."
},
"enum": {
"oneOf": [
{
Expand Down Expand Up @@ -301,11 +299,6 @@
"type": "boolean",
"description": "When `true`, each value for the property `MUST` be unique."
},
"pattern": {
"type": "string",
"description": "A regular expression pattern to test each value of the property against, where a truthy response indicates validity.",
"context": "Regular expressions `SHOULD` conform to the [XML Schema regular expression syntax](http://www.w3.org/TR/xmlschema-2/#regexs)."
},
"enum": {
"oneOf": [
{
Expand Down Expand Up @@ -767,11 +760,6 @@
"type": "boolean",
"description": "When `true`, each value for the property `MUST` be unique."
},
"pattern": {
"type": "string",
"description": "A regular expression pattern to test each value of the property against, where a truthy response indicates validity.",
"context": "Regular expressions `SHOULD` conform to the [XML Schema regular expression syntax](http://www.w3.org/TR/xmlschema-2/#regexs)."
},
"enum": {
"type": "array",
"minItems": 1,
Expand Down Expand Up @@ -834,6 +822,13 @@
"boolean"
]
},
"format": {
"description": "There are no format keyword options for `boolean`: only `default` is allowed.",
"enum": [
"default"
],
"default": "default"
},
"trueValues": {
"type": "array",
"minItems": 1,
Expand Down Expand Up @@ -1549,7 +1544,8 @@
"description": "Values that when encountered in the source, should be considered as `null`, 'not present', or 'blank' values.",
"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).",
"examples": [
"{\n \"missingValues\": [\n \"-\",\n \"NaN\",\n \"\"\n ]\n}\n"
"{\n \"missingValues\": [\n \"-\",\n \"NaN\",\n \"\"\n ]\n}\n",
"{\n \"missingValues\": []\n}\n"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion tests/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function provideInvalidDescriptors(): array
{
return [
[
'[] Array value found, but an object is required',
'[] Array value found, but a string or an object is required',
[],
],
[
Expand Down

0 comments on commit 1443327

Please sign in to comment.