open-contracting / standard_extension_template

Use this template to author your OCDS extensions
Apache License 2.0
5 stars 8 forks source link

Add schema for extensions.json #3

Closed timgdavies closed 7 years ago

timgdavies commented 7 years ago

There should be a schema for extension.json, and a test to validate this.

edugomez commented 7 years ago
{
  "id": "http://example.com",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Extension schema",
  "description": "Schema for extension.json file in an OCDS extension bundle.",
  "type": "object",
  "required": [
    "description",
    "documentationUrl",
    "name"
  ],
  "additionalProperties": false,
  "properties": {
    "codelists": {
      "title": "Extension codelists",
      "description": "Codelists for this extension",
      "type": "array",
      "item" : {
        "type": "string",
        "pattern": "^.+\\.csv$"
      }
    },
    "compatibilty": {
      "title": "Compatibilty",
      "description": "OCDS standard version this extension is compatible with.",
      "type": "string"
    },
    "dependencies": {
      "title": "Dependencies",
      "description": "Extensions this extension depends on.",
      "type": "array",
      "items":{
        "type": "string",
        "format": "uri",
        "pattern": "^.+/extension\\.json$"
      }
    },
    "description": {
      "title": "Description",
      "description": "Description of the extensions as an object with keys being language codes (ISO 639-1) and values the description in that language.",
      "type": "object",
      "minProperties": 1,
      "additionalProperties": false,
      "patterProperties": {
        "^(ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bl|bm|bn|bo|bq|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|en|er|es|et|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mf|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)$": {
          "type": "string"
        }
      }
    },
    "documentationUrl": {
      "title": "Documentation URL" ,
      "description": "Location of the documentation for the extension as an object with keys being language codes (ISO 639-1) and values the url of the documentation in that language.",
      "type": "object",
      "minProperties": 1,
      "additionalProperties": false,
      "patternProperties": {
        "^(ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bl|bm|bn|bo|bq|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|en|er|es|et|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mf|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)$": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "name": {
      "title": "Name",
      "description": "Name of the extension as an object with keys being language codes (ISO 639-1) and values the name in that language",
      "type": "object",
      "minProperties": 1,
      "additionalProperties": false,
      "patternProperties": {
        "^(ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bl|bm|bn|bo|bq|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|en|er|es|et|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mf|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)$": {
          "type": "string"
        }
      }
    }
  }
}
edugomez commented 7 years ago

Notice addition of documentationUrl (required) and codelist (boolean, not required) to extension.json. @timgdavies @kindly, if we decide to go ahead with this then we can write the test mentioned above and start modifying existing extensions.

edugomez commented 7 years ago

This is currently in PR https://github.com/open-contracting/standard_extension_template/pull/6

timgdavies commented 7 years ago

This has now been done.