schema: add json-schema describing our manifest

This adds a non-binding, documentational-only json-schema to
schemas/osbuild1.json which describes the format of the pipeline
manifest taken as input to osbuild. This is currently for
documentational purposes, but is definitely open to be used for actual
runtime verification.

The manifest does not describe options to assemblers, stages, or
sources. These are left as arbitrary json-objects and need separate
validation, if required. Note that most stages already contain an
embedded schema for their parameters.
This commit is contained in:
David Rheinsberg 2020-03-06 12:16:22 +01:00
parent 108aa87232
commit 911fa1d92b

90
schemas/osbuild1.json Normal file
View file

@ -0,0 +1,90 @@
{
"$schema": "https://json-schema.org/schema",
"$id": "https://osbuild.org/schemas/osbuild1.json",
"title": "OSBuild Manifest",
"description": "OSBuild manifest describing a pipeline and all parameters",
"type": "object",
"additionalProperties": false,
"properties": {
"pipeline": { "$ref": "#/definitions/pipeline" },
"sources": { "$ref": "#/definitions/sources" }
},
"required": [],
"definitions": {
"assembler": {
"title": "Pipeline Assembler",
"description": "Final stage of a pipeline that assembles the result",
"type": "object",
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"options": {
"type": "object",
"additionalProperties": true
}
},
"required": [ "name" ]
},
"build": {
"title": "Build Pipeline",
"description": "Description of the build pipeline required to run stages",
"type": "object",
"additionalProperties": false,
"properties": {
"pipeline": { "$ref": "#/definitions/pipeline" },
"runner": { "type": "string" }
},
"required": [ "pipeline", "runner" ]
},
"pipeline": {
"title": "Pipeline Description",
"description": "Full description of a pipeline to execute",
"type": "object",
"additionalProperties": false,
"properties": {
"assembler": { "$ref": "#/definitions/assembler" },
"build": { "$ref": "#/definitions/build" },
"stages": { "$ref": "#/definitions/stages" }
},
"required": []
},
"source": {
"title": "External Source",
"description": "External source to be passed to the pipeline",
"type": "object",
"additionalProperties": true
},
"sources": {
"title": "Collection of External Sources",
"description": "Collection of external sources to be passed to the pipeline",
"type": "object",
"additionalProperties": { "$ref": "#/definitions/source" }
},
"stage": {
"title": "Pipeline Stage",
"description": "Single stage of a pipeline executing one step",
"type": "object",
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"options": {
"type": "object",
"additionalProperties": true
}
},
"required": [ "name" ]
},
"stages": {
"type": "array",
"items": { "$ref": "#/definitions/stage" }
}
}
}