biocompute-objects / BCO_Documentation

Repository for documentation to support the IEEE 2791-2020 standard. Please see our home page for communications/publications:
http://biocomputeobject.org/
BSD 3-Clause "New" or "Revised" License
16 stars 12 forks source link

UVP-BCO@c33e365 feedback #62

Closed corburn closed 2 years ago

corburn commented 5 years ago

@HadleyKing following up on https://github.com/biocompute-objects/UVP-BCO/commit/c33e365fafbfe42ee3f4ffeb43f7a0fb5d1e1786#commitcomment-31591403

pipeline_steps validation

Inserting "additionalProperties": false, into the pipeline_steps definition would catch errors such the following prerequisites typo:

jsonschema.exceptions.ValidationError: Additional properties are not allowed ('prerequisites' was unexpected)

uri-in-uri stutter

Fields such as the following could be flattened using the JSON Schema allOf property:

"software_prerequisites": [{
    "name": "BEDtools",
    "version": "2.17.0",
    "uri": {
        "uri": "http://example.com/example"
    }
}]
"software_prerequisites": {
  "type": "array",
  "description": "Minimal necessary prerequisites, library, tool versions needed to successfully run the script to produce BCO.",
  "items": {
    "allOf": [
      { "$ref": "biocomputeobject.json#/definitions/uri" },
      {
        "type": "object",
        "description": "A necessary prerequisite, library, or tool version.",
        "required": [ "name", "version" ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "description": "Names of software prerequisites",
            "examples": [ "HIVE-hexagon" ]
          },
          "version": {
            "type": "string",
            "description": "Versions of the software prerequisites",
            "examples": [ "babajanian.1" ]
          },
        },
      }
    ]
  }
},
"software_prerequisites": [{
    "name": "BEDtools",
    "version": "2.17.0",
    "uri": "http://example.com/example"
}]
corburn commented 5 years ago

@HadleyKing @jpat1546

The following TODO comment was removed unresolved: https://github.com/biocompute-objects/BCO_Specification/commit/1d54f576a4b491726cc202f67c0833d416ed0a15#diff-656fd9726e4db1f485efc2dbd8abbd64L16

"$comment": "TODO: Need to find a way to specify 'filename' is required here.",

It could be resolved with an allOf definition similar to the software_prerequisites above.

HadleyKing commented 5 years ago

@corburn - RE:

uri-in-uri stutter Fields such as the following could be flattened using the JSON Schema allOf property:

I am having trouble implementing this. On the allOf documentation page it says the following:

This works, but what if we wanted to restrict the schema so no additional properties are allowed? One might try adding the highlighted line below:


{
"definitions": {
"address": {
"type": "object",
"properties": {
"street_address": { "type": "string" },
"city":           { "type": "string" },
"state":          { "type": "string" }
},
"required": ["street_address", "city", "state"]
}
},

"allOf": [ { "$ref": "#/definitions/address" }, { "properties": { "type": { "enum": [ "residential", "business" ] } } } ],

"additionalProperties": false } { "street_address": "1600 Pennsylvania Avenue NW", "city": "Washington", "state": "DC", "type": "business" }


>Unfortunately, now the schema will reject everything. This is because the Properties refers to the entire schema. And that entire schema includes no properties, and knows nothing about the properties in the subschemas inside of the allOf array.

>This shortcoming is perhaps one of the biggest surprises of the combining operations in JSON schema: it does not behave like inheritance in an object-oriented language. There are some proposals to address this in the next version of the JSON schema specification.

Would that be why?