frictionlessdata / datapackage-java

A Java library for working with Frictionless Data Data Packages.
MIT License
20 stars 7 forks source link

Data Resource JSON schema definition for `schema` seems to contradict specification #30

Closed iSnow closed 4 years ago

iSnow commented 4 years ago

Overview

Caution: there's a lot of different uses of "schema" coming, so bear with me...

in src/main/resources/, we find the JSON schema definition files for the various parts of a DataPackage. Among them is data-resource.json, where the formal definition for a schema property of a Resource is:

"schema": {
  "propertyOrder": 40,
  "title": "Schema",
  "description": "A schema for this resource.",
  "type": "object"
},

This allows only JSON-objects as schema definitions, essentially JSON-Strings. It disallows URLs or file paths.

This seemingly contradicts the specification of a schema property:

The value for the schema property on a resource MUST be an object representing the schema OR a string that identifies the location of the schema.

(Emphasis mine).

I believe it should read (not sure about the syntax):

"oneOf": [
    {
      "title": "Schema path",
      "description": "A fully qualified URL, or a POSIX file path..",
      "type": "string"
    },
    {
      "title": "Schema encoded as JSON",
      "type": "object"
    }
]

Please preserve this line to notify @georgeslabreche (lead of this repository)

iSnow commented 4 years ago

Also @roll - that problem isn't specific to the Java implementation, it exists in the spec repository: https://frictionlessdata.io/schemas/data-resource.json as well. I filed a bug against that, and we can probably close this one here.

roll commented 4 years ago

https://github.com/frictionlessdata/specs/issues/645