---
dataResource:
  title: Data Resource
  description: Data Resource.
  type: object
  oneOf:
    - required:
      - name
      - data
    - required:
      - name
      - path
  properties:
    profile:
      "$ref": "#/definitions/profile"
      propertyOrder: 10
      default: "data-resource"
    name:
      "$ref": "#/definitions/name"
      propertyOrder: 20
    path:
      "$ref": "#/definitions/resourcePath"
      propertyOrder: 30
    data:
      "$ref": "#/definitions/data"
      propertyOrder: 230
    schema:
      "$ref": "#/definitions/anySchema"
      propertyOrder: 40
    title:
      "$ref": "#/definitions/title"
      propertyOrder: 50
    description:
      "$ref": "#/definitions/description"
      propertyOrder: 60
      format: textarea
    homepage:
      "$ref": "#/definitions/homepage"
      propertyOrder: 70
    sources:
      "$ref": "#/definitions/sources"
      propertyOrder: 140
      options:
        hidden: true
    licenses:
      "$ref": "#/definitions/licenses"
      description: The license(s) under which the resource is published.
      propertyOrder: 150
      options:
        hidden: true
    format:
      "$ref": "#/definitions/format"
      propertyOrder: 80
    mediatype:
      "$ref": "#/definitions/mediatype"
      propertyOrder: 90
    encoding:
      "$ref": "#/definitions/encoding"
      propertyOrder: 100
    bytes:
      "$ref": "#/definitions/bytes"
      propertyOrder: 110
      options:
        hidden: true
    hash:
      "$ref": "#/definitions/hash"
      propertyOrder: 120
      options:
        hidden: true
tabularDataResource:
  title: Tabular Data Resource
  description: A Tabular Data Resource.
  type: object
  oneOf:
    - required:
      - name
      - data
      - schema
      - profile
    - required:
      - name
      - path
      - schema
      - profile
  properties:
    profile:
      "$ref": "#/definitions/profile"
      enum: ["tabular-data-resource"]
      propertyOrder: 10
    name:
      "$ref": "#/definitions/name"
      propertyOrder: 20
    path:
      "$ref": "#/definitions/resourcePath"
      propertyOrder: 30
    data:
      "$ref": "#/definitions/data"
      propertyOrder: 230
    schema:
      "$ref": "#/definitions/tableSchema"
      propertyOrder: 40
    title:
      "$ref": "#/definitions/title"
      propertyOrder: 50
    description:
      "$ref": "#/definitions/description"
      propertyOrder: 60
      format: textarea
    homepage:
      "$ref": "#/definitions/homepage"
      propertyOrder: 70
    sources:
      "$ref": "#/definitions/sources"
      propertyOrder: 140
      options:
        hidden: true
    licenses:
      "$ref": "#/definitions/licenses"
      description: The license(s) under which the resource is published.
      propertyOrder: 150
      options:
        hidden: true
    dialect:
      "$ref": "#/definitions/csvDialect"
      propertyOrder: 50
    format:
      "$ref": "#/definitions/format"
      propertyOrder: 80
    mediatype:
      "$ref": "#/definitions/mediatype"
      propertyOrder: 90
    encoding:
      "$ref": "#/definitions/encoding"
      propertyOrder: 100
    bytes:
      "$ref": "#/definitions/bytes"
      propertyOrder: 110
      options:
        hidden: true
    hash:
      "$ref": "#/definitions/hash"
      propertyOrder: 120
      options:
        hidden: true
pathArray:
  type: array
  minItems: 1
  items:
    "$ref": "#/definitions/path"
  examples:
  - |
      [ "file.csv" ]
  - |
      [ "http://example.com/file.csv" ]
resourcePath:
  title: Path
  description: A reference to the data for this resource, as either a path as a string, or an array of paths as strings.
    of valid URIs.
  oneOf: [
    { "$ref": "#/definitions/path" },
    { "$ref": "#/definitions/pathArray" }
  ]
  context: The dereferenced value of each referenced data source in `path`
    `MUST` be commensurate with a native, dereferenced representation of the data
    the resource describes. For example, in a *Tabular* Data Resource, this means
    that the dereferenced value of `path` `MUST` be an array.
  examples:
  - |
      {
        "path": [
          "file.csv",
          "file2.csv"
        ]
      }
  - |
      {
        "path": [
          "http://example.com/file.csv",
          "http://example.com/file2.csv"
        ]
      }
  - |
      {
        "path": "http://example.com/file.csv"
      }
format:
  title: Format
  description: The file format of this resource.
  context: "`csv`, `xls`, `json` are examples of common formats."
  type: string
  examples:
  - |
      {
        "format": "xls"
      }
mediatype:
  title: Media Type
  description: The media type of this resource. Can be any valid media type listed
    with [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml).
  type: string
  pattern: "^(.+)/(.+)$"
  examples:
  - |
      {
        "mediatype": "text/csv"
      }
encoding:
  title: Encoding
  description: The file encoding of this resource.
  type: string
  default: utf-8
  examples:
  - |
      {
        "encoding": "utf-8"
      }
bytes:
  title: Bytes
  description: The size of this resource in bytes.
  type: integer
  examples:
  - |
      {
        "bytes": 2082
      }
hash:
  title: Hash
  type: string
  description: The MD5 hash of this resource. Indicate other hashing algorithms
    with the {algorithm}:{hash} format.
  pattern: "^([^:]+:[a-fA-F0-9]+|[a-fA-F0-9]{32}|)$"
  examples:
  - |
      {
        "hash": "d25c9c77f588f5dc32059d2da1136c02"
      }
  - |
      {
        "hash": "SHA256:5262f12512590031bbcc9a430452bfd75c2791ad6771320bb4b5728bfb78c4d0"
      }
