This commit is contained in:
92
schemas/api-config/hooks.json
Normal file
92
schemas/api-config/hooks.json
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "JSON Schema WMBasic hooks configuration",
|
||||
"description": "WMBasic hooks linter",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"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"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user