tibi-types/schemas/api-config/hooks.json

106 lines
3.6 KiB
JSON
Raw Permalink Normal View History

2022-02-01 18:59:17 +01:00
{
"$schema": "http://json-schema.org/draft-07/schema#",
2022-02-26 10:43:52 +01:00
"title": "JSON Schema tibi-server hooks configuration",
"description": "tibi-server hooks linter",
2022-02-01 18:59:17 +01:00
"type": "object",
"additionalProperties": false,
2022-10-12 16:23:32 +02:00
"patternProperties": {
"^x\\-": {
"description": "template property"
}
},
2022-02-01 18:59:17 +01:00
"properties": {
"get": {
"type": "object",
"description": "hooks for http GET",
"additionalProperties": false,
"properties": {
"read": {
"description": "hook before reading from database",
"$ref": "#/definitions/hookDef"
},
"return": {
"description": "hook before returning entries read from database",
"$ref": "#/definitions/hookDef"
}
}
},
"post": {
"type": "object",
"description": "hooks for http POST",
"additionalProperties": false,
"properties": {
"bind": {
"description": "hook before binding data from post request",
"$ref": "#/definitions/hookDef"
},
2022-11-02 12:16:18 +01:00
"validate": {
"description": "hook before validation data",
"$ref": "#/definitions/hookDef"
},
2022-02-01 18:59:17 +01:00
"create": {
"description": "hook before creating entry in database",
"$ref": "#/definitions/hookDef"
},
"return": {
"description": "hook before returning result (after database write)",
"$ref": "#/definitions/hookDef"
}
}
},
"put": {
"type": "object",
"description": "hooks for http PUT",
"additionalProperties": false,
"properties": {
"bind": {
"description": "hook before binding data from put request",
"$ref": "#/definitions/hookDef"
},
2022-11-02 12:16:18 +01:00
"validate": {
"description": "hook before validation data",
"$ref": "#/definitions/hookDef"
},
2022-02-01 18:59:17 +01:00
"update": {
"description": "hook before updating entry in database",
"$ref": "#/definitions/hookDef"
},
"return": {
"description": "hook before returning result (after database write)",
"$ref": "#/definitions/hookDef"
}
}
},
"delete": {
"type": "object",
"description": "hooks for http DELETE",
"additionalProperties": false,
"properties": {
"delete": {
"description": "hook before deleting entry from database",
"$ref": "#/definitions/hookDef"
},
"return": {
"description": "hook before returning result (after database write)",
"$ref": "#/definitions/hookDef"
}
}
}
},
"definitions": {
"hookDef": {
"type": "object",
"properties": {
"type": {
"const": "javascript"
},
"file": {
"type": "string",
"description": "location of javascript hook file relative to config.yml base"
}
},
"required": ["type", "file"]
}
}
}