-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): schema validation for disabled
- Loading branch information
Showing
4 changed files
with
49 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
|
||
{mutate} = require 'mixme' | ||
|
||
module.exports = | ||
name: '@nikitajs/core/src/plugins/metadata/disabled' | ||
hooks: | ||
'nikita:schema': ({schema}) -> | ||
mutate schema.definitions.metadata.properties, | ||
disabled: | ||
type: 'boolean' | ||
description: ''' | ||
Disable the execution of the current action and consequently the | ||
execution of its child actions. | ||
''' | ||
default: false | ||
'nikita:action': (action, handler) -> | ||
# Note, we dont enforce schema validation before it because | ||
# When a plugin a disabled, chances are that not all its property | ||
# where passed correctly and we don't want schema validation | ||
# to throw an error in such cases | ||
action.metadata.disabled ?= false | ||
if action.metadata.disabled then null else handler | ||
if action.metadata.disabled is true then null else handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters