Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions content/docs/standard/data-resource.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ If `path` property is not provided but there is a `url` property as was defined
A Data Resource descriptor `MAY` contain a property `type` that `MUST` be a string with the following possible values:

- `table`: indicates that the resource is tabular as per [Tabular Data](/standard/glossary/#tabular-data) definition. Please read more about [Tabular Resource](#tabular) properties.
- `json`: indicates that the resource is JSON as per [JSON Data](/standard/glossary/#json-data) definition. Please read more about [JSON Resource](#json) properties.

If property `type` is not provided, the resource is considered to be a non-specific file. An implementation `MAY` provide some additional interfaces, for example, tabular, to non-specific files if `type` can be detected from the data source or format.

Expand Down Expand Up @@ -211,6 +212,10 @@ List of licenses as for [Data Package](/standard/data-package/#licenses). If not

The properties below are applicable to any Tabular Data Resource.

#### `type` {#tabular-type}

A Tabular Data Resource descriptor `SHOULD` contain a property `type` that `MUST` be `table`.

#### `path` or `data` [required] {#tabular-path-or-data}

If the `path` property is used for providing data than it `MUST` contain [Tabular Data](/standard/glossary/#tabular-data).
Expand Down Expand Up @@ -275,3 +280,38 @@ An example of a resource with a schema:
}
}
```

### JSON

The properties below are applicable to any JSON Data Resource.

#### `type` {#json-type}

A JSON Data Resource descriptor `SHOULD` contain a property `type` that `MUST` be `json`.

#### `path` or `data` [required] {#json-path-or-data}

If the `path` property is used for providing data than it `MUST` contain [JSON Data](/standard/glossary/#json-data).

If the `data` property is used for providing data for a JSON Data Resource than it `MUST` be an inline instance of [JSON Data](/standard/glossary/#json-data).

#### `jsonSchema`

A JSON Data Resource `MAY` have a `jsonSchema` property to provide a JSON Schema of the resource data. If provided, the `jsonSchema` property `MUST` be a valid [JSON Schema](https://json-schema.org) descriptor in a form of an object or [URL-or-Path](/standard/glossary/#url-or-path).

An example of a resource with a JSON Schema:

```json
{
"name": "data",
"type": "json",
"path": "data.json",
"jsonSchema": {
"type": "object",
"properties": {
"givenName": { "type": "string" },
"familyName": { "type": "string" }
}
}
}
```
16 changes: 16 additions & 0 deletions content/docs/standard/glossary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,22 @@ In JSON, a table would be:
]
```

### JSON Data

JSON data is a valid [JSON](https://www.json.org) object. For example:

```json
{
"name": "John Doe",
"age": 30,
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA"
}
}
```

### Data Representation

In order to talk about the representation and processing of tabular data from text-based sources, it is useful to introduce the concepts of the _physical_ and the _logical_ representation of data.
Expand Down
10 changes: 10 additions & 0 deletions profiles/dictionary/resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ dataResource:
schema:
"$ref": "#/definitions/tableSchema"
propertyOrder: 140
jsonSchema:
"$ref": "#/definitions/jsonSchema"
propertyOrder: 140
pathArray:
type: array
minItems: 1
Expand Down Expand Up @@ -115,6 +118,7 @@ resourceType:
type: string
enum:
- table
- json
format:
title: Format
description: The file format of this resource.
Expand Down Expand Up @@ -170,3 +174,9 @@ hash:
{
"hash": "SHA256:5262f12512590031bbcc9a430452bfd75c2791ad6771320bb4b5728bfb78c4d0"
}
jsonSchema:
title: JSON schema
description: A JSON Schema for this resource, compliant with the JSON Schema specification.
type:
- string
- object
12 changes: 11 additions & 1 deletion public/profiles/2.1/datapackage.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@
"propertyOrder": 235,
"type": "string",
"enum": [
"table"
"table",
"json"
]
},
"title": {
Expand Down Expand Up @@ -3404,6 +3405,15 @@
"examples": [
"{\n \"schema\": {\n \"fields\": [\n {\n \"name\": \"first_name\",\n \"type\": \"string\"\n \"constraints\": {\n \"required\": true\n }\n },\n {\n \"name\": \"age\",\n \"type\": \"integer\"\n },\n ],\n \"primaryKey\": [\n \"name\"\n ]\n }\n}\n"
]
},
"jsonSchema": {
"propertyOrder": 140,
"title": "JSON schema",
"description": "A JSON Schema for this resource, compliant with the JSON Schema specification.",
"type": [
"string",
"object"
]
}
}
},
Expand Down
12 changes: 11 additions & 1 deletion public/profiles/2.1/dataresource.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"propertyOrder": 235,
"type": "string",
"enum": [
"table"
"table",
"json"
]
},
"title": {
Expand Down Expand Up @@ -3168,6 +3169,15 @@
"examples": [
"{\n \"schema\": {\n \"fields\": [\n {\n \"name\": \"first_name\",\n \"type\": \"string\"\n \"constraints\": {\n \"required\": true\n }\n },\n {\n \"name\": \"age\",\n \"type\": \"integer\"\n },\n ],\n \"primaryKey\": [\n \"name\"\n ]\n }\n}\n"
]
},
"jsonSchema": {
"propertyOrder": 140,
"title": "JSON schema",
"description": "A JSON Schema for this resource, compliant with the JSON Schema specification.",
"type": [
"string",
"object"
]
}
}
}