Skip to content

Commit

Permalink
feat(core): metadata header multi-level array
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Jun 17, 2024
1 parent b70a45a commit f5b30b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
9 changes: 7 additions & 2 deletions packages/core/lib/plugins/metadata/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ export default {
'nikita:schema': function({schema}) {
mutate(schema.definitions.metadata.properties, {
header: {
type: 'string',
description: `Associate a title with the current action.`
// type: ['array', 'string'],
type: 'array',
items: {
type: ['string']
},
coercion: true,
description: `Associate a title with the current action, eg used by log actions.`
}
});
}
Expand Down
18 changes: 14 additions & 4 deletions packages/core/test/plugins/metadata/header.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,22 @@ describe 'plugins.metadata.header', ->
.should.be.rejectedWith
code: 'NIKITA_SCHEMA_VALIDATION_CONFIG'
message: [
'NIKITA_SCHEMA_VALIDATION_CONFIG:'
'one error was found in the configuration of root action:'
'nikita#/definitions/metadata/properties/header/type'
'metadata/header must be string, type is "string".'
# 'NIKITA_SCHEMA_VALIDATION_CONFIG:'
# 'one error was found in the configuration of root action:'
# 'nikita#/definitions/metadata/properties/header/type'
# 'metadata/header must be string, type is "string".'
'NIKITA_SCHEMA_VALIDATION_CONFIG:',
'multiple errors were found in the configuration of root action:',
'nikita#/definitions/metadata/properties/header/items/type metadata/header/0 must be string,',
'type is ["string"];'
'nikita#/definitions/metadata/properties/header/items/type metadata/header/1 must be string,',
'type is ["string"].'
].join ' '

it 'coersion', ->
nikita $header: 'Some header', ({metadata: {header}}) ->
header.should.eql ['Some header']

it 'default', ->
nikita ({metadata: {header}}) ->
should(header is undefined).be.true()

0 comments on commit f5b30b6

Please sign in to comment.