Skip to content

Instantly share code, notes, and snippets.

@garethr
Last active December 31, 2018 11:11
Show Gist options
  • Save garethr/5e45b35bff950ad3b62dd98fe592f3d3 to your computer and use it in GitHub Desktop.
Save garethr/5e45b35bff950ad3b62dd98fe592f3d3 to your computer and use it in GitHub Desktop.
CNAB JSON Schema and questions based on the current specification
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"schemaVersion": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"description": {
"type": "string"
},
"keywords": {
"type": "array",
"items": {
"type": "string"
}
},
"maintainers": {
"type": "array",
"items": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
]
},
"invocationImages": {
"type": "array",
"items": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"imageType": {
"type": "string",
"default": "oci"
},
"image": {
"type": "string"
},
"digest": {
"type": "string"
},
"size": {
"type": "string"
},
"platform": {
"type": "object",
"additionalProperties": false,
"properties": {
"architecture": {
"type": "string"
},
"os": {
"type": "string"
}
}
},
"mediaType": {
"type": "string"
}
},
"required": [
"image"
]
}
]
},
"images": {
"type": "array",
"items": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"description": {
"type": "string"
},
"imageType": {
"type": "string",
"default": "oci"
},
"image": {
"type": "string"
},
"digest": {
"type": "string"
},
"size": {
"type": "integer"
},
"platform": {
"type": "object",
"additionalProperties": false,
"properties": {
"architecture": {
"type": "string"
},
"os": {
"type": "string"
}
}
},
"mediaType": {
"type": "string"
},
"refs": {
"type": "array",
"items": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
},
"field": {
"type": "string"
},
"mediaType": {
"type": "string"
}
}
}
]
}
},
"required": [
"image"
]
}
]
},
"parameters": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"enum": ["string", "int", "boolean"]
},
"required": {
"type": "boolean"
},
"defaultValue": {
"anyOf": [
{"type": "string"},
{"type": "integer"},
{"type": "boolean"},
{"type": "null"}
]
},
"allowedValues": {
"type": "array"
},
"minValue": {
"type": "integer"
},
"maxValue": {
"type": "integer"
},
"minLength": {
"type": "integer"
},
"maxLength": {
"type": "integer"
},
"metadata": {
"type": "object",
"additionalProperties": false,
"properties": {
"description": {
"type": "string"
}
}
},
"destination": {
"type": "object",
"additionalProperties": false,
"properties": {
"env": {
"type": "string"
},
"path": {
"type": "string"
},
"description": {
"type": "string"
}
}
}
},
"required": [
"type"
]
}
},
"credentials": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
},
"env": {
"type": "string"
},
"description": {
"type": "string"
}
}
}
},
"actions": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"modifies": {
"type": "boolean"
}
}
}
}
},
"required": [
"name",
"version",
"invocationImages"
]
}
  1. is schemaVersion required?
  2. If schemaVersion is not required, what is the expected behaviour?
  3. The example in the spec has a uri field for images, but the spec doesn't mention this field?
  4. For field selectors section referring to other specs (like the rough JsonPath, JSON Pointer - RFC6901 and XPath) might be wise
  5. Should invocationImages be required?
  6. Should additionalProperties be allowed that are not defined in the spec?
  7. string, int, boolean for parameters.type shortens int but doesn't shorten boolean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment