diff --git a/internal/resource/schemas/certificate.schema.json b/internal/resource/schemas/certificate.schema.json index 33d28a8..cc38f5d 100644 --- a/internal/resource/schemas/certificate.schema.json +++ b/internal/resource/schemas/certificate.schema.json @@ -3,6 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "certificate", "type": "object", + "required": [], "properties": { "publickey": { "type": "string" @@ -15,8 +16,8 @@ }, "SerialNumber": { "type": "integer", - "description": "Serial number", - "minLength": 1 + "description": "Serial number", + "minLength": 1 }, "Issuer": { "$ref": "pkixname.schema.json" diff --git a/internal/resource/schemas/constraints.schema.json b/internal/resource/schemas/constraints.schema.json new file mode 100644 index 0000000..0f9d988 --- /dev/null +++ b/internal/resource/schemas/constraints.schema.json @@ -0,0 +1,9 @@ +{ + "$id": "constraints.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "constraints", + "type": "object", + "additionalProperties": { + "type": ["string", "number", "object", "array", "boolean", "null"] + } +} diff --git a/internal/resource/schemas/dependencies.schema.json b/internal/resource/schemas/dependencies.schema.json new file mode 100644 index 0000000..db1bc3f --- /dev/null +++ b/internal/resource/schemas/dependencies.schema.json @@ -0,0 +1,9 @@ +{ + "$id": "dependencies.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "dependencies", + "type": "object", + "additionalProperties": { + "$ref": "constraints.schema.json" + } +} diff --git a/internal/resource/schemas/document.schema.json b/internal/resource/schemas/document.schema.json index 6dbd353..9e30bdd 100644 --- a/internal/resource/schemas/document.schema.json +++ b/internal/resource/schemas/document.schema.json @@ -3,9 +3,26 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "document", "type": "object", - "required": [ - ], + "required": [], "properties": { + "source": { + "type": "string", + "description": "Document URI" + }, + "format": { + "$ref": "codec.schema.json" + }, + "requires": { + "$ref": "dependencies.schema.json" + }, + "imports": { + "type": "array", + "description": "List of other documents to import", + "items": { + "type": "string", + "description": "Document URI" + } + }, "configurations": { "type": "array", "description": "Configurations list", @@ -31,6 +48,7 @@ { "$ref": "iptable-declaration.schema.json" }, { "$ref": "network-route-declaration.schema.json" }, { "$ref": "openpgp-keyring-declaration.schema.json" }, + { "$ref": "openpgp-signature-declaration.schema.json" }, { "$ref": "package-declaration.schema.json" }, { "$ref": "pki-declaration.schema.json" }, { "$ref": "user-declaration.schema.json" } diff --git a/internal/resource/schemas/file-declaration.schema.json b/internal/resource/schemas/file-declaration.schema.json index 5b88be8..68025d1 100644 --- a/internal/resource/schemas/file-declaration.schema.json +++ b/internal/resource/schemas/file-declaration.schema.json @@ -10,10 +10,22 @@ "description": "Resource type name.", "enum": [ "file" ] }, + "transition": { + "$ref": "storagetransition.schema.json" + }, "config": { "type": "string", "description": "Config name" }, + "onerror": { + "type": "string", + "description": "error handling strategy", + "enum": [ + "stop", + "fail", + "skip" + ] + }, "attributes": { "$ref": "file.schema.json" } diff --git a/internal/resource/schemas/file.schema.json b/internal/resource/schemas/file.schema.json index 79f82ee..a63236d 100644 --- a/internal/resource/schemas/file.schema.json +++ b/internal/resource/schemas/file.schema.json @@ -7,8 +7,8 @@ "properties": { "path": { "type": "string", - "description": "file path", - "minLength": 1 + "description": "file path", + "minLength": 1 }, "owner": { "type": "string" diff --git a/internal/resource/schemas/openpgp-keyring-declaration.schema.json b/internal/resource/schemas/openpgp-keyring-declaration.schema.json index 2915e21..8b2e668 100644 --- a/internal/resource/schemas/openpgp-keyring-declaration.schema.json +++ b/internal/resource/schemas/openpgp-keyring-declaration.schema.json @@ -8,7 +8,7 @@ "type": { "type": "string", "description": "Resource type name.", - "enum": [ "file" ] + "enum": [ "openpgp-keyring" ] }, "config": { "type": "string", diff --git a/internal/resource/schemas/openpgp-signature-declaration.schema.json b/internal/resource/schemas/openpgp-signature-declaration.schema.json new file mode 100644 index 0000000..5fe08ff --- /dev/null +++ b/internal/resource/schemas/openpgp-signature-declaration.schema.json @@ -0,0 +1,21 @@ +{ + "$id": "openpgp-signature-declaration.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "openpgp-signature-declaration", + "type": "object", + "required": [ "type", "attributes" ], + "properties": { + "type": { + "type": "string", + "description": "Resource type name.", + "enum": [ "openpgp-signature" ] + }, + "config": { + "type": "string", + "description": "Config name" + }, + "attributes": { + "$ref": "openpgp-signature.schema.json" + } + } +} diff --git a/internal/resource/schemas/openpgp-signature.schema.json b/internal/resource/schemas/openpgp-signature.schema.json new file mode 100644 index 0000000..93d71e0 --- /dev/null +++ b/internal/resource/schemas/openpgp-signature.schema.json @@ -0,0 +1,23 @@ +{ + "$id": "openpgp-signature.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "openpgp-signature", + "type": "object", + "required": [ ], + "properties": { + "signature": { + "type": "string", + "description": "ASCII-armored PGP signature" + }, + "sourceref": { + "$ref": "ref.schema.json" + }, + "keyringref": { + "$ref": "ref.schema.json" + }, + "signatureref": { + "$ref": "ref.schema.json", + "description": "file content signature uri" + } + } +} diff --git a/internal/resource/schemas/ref.schema.json b/internal/resource/schemas/ref.schema.json new file mode 100644 index 0000000..94b2d26 --- /dev/null +++ b/internal/resource/schemas/ref.schema.json @@ -0,0 +1,17 @@ +{ + "$id": "ref.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ref", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of object referred to", + "enum": [ "resource", "document" ] + }, + "uri": { + "type": "string", + "description": "URI of the object referred to" + } + } +}