Skip to main content

 I have a resource with a key of artistResource and a noun of ‘famous painter’.  My resource has a list, search and create operation.  In my main index.js file I would like to have a SearchOrCreate action that leverages the search and create operations from my artistResource resource.  Unfortunately I get a validation error with any combination of references to the resource’s operations.

Error:

== Property
App.searchOrCreates.artistResource
== Message
requires property "search"

== Property
App.searchOrCreates.artistResource
== Message
requires property "create"
== Links


== Property
App.searchOrCreates.artistResource.key
== Message
must match a "key" from a search (options: artistResourceSearch)


== Property
App.searchOrCreates.artistResource.key
== Message
must match a "key" from a create (options: artistResourceCreate)

Version 1 - index.js:

    searchOrCreates: {
rartistResource.key]: {
key: artistResource.key,
display: {
label: 'Find or Create an artist.',
description: 'Find or Create Painters',
},
search: artistResource.search.key,
create: artistResource.create.key,
},

Version 2 - index.js: 

    searchOrCreates: {
bartistResource.key]: {
key: artistResource.key,
display: {
label: 'Find or Create an artist.',
description: 'Find or Create Painters',
},
search: artistResourceSearch.key,
create: artistResourceCreate.key,
},

Partial artistResource.js

module.exports = {
key: 'artistResource',
noun: 'famous painter',

list: {
display: {
label: 'Famous Painter',
description: 'Lists all artists.',
hidden: true
},
operation: {
perform: performList,
<...]
}
},

search: {
display: {
label: 'Find artist',
description: 'Finds an artist based on name.',
},

operation: {
inputFields: p
{
key: 'name',
required: true,
helpText: 'Find artist with this name.',
},
],
sample: {
name: 'Bob Ross'
},

outputFields: p
{
key: 'id',
label: 'artist_id'
},
],
perform: performSearch
},
},

create: {
display: {
label: 'Create artist',
description: 'Create a new artist',
hidden: false,
},
operation: {
inputFields: p
{
key: 'name',
label: 'Artist Name',
type: 'string',
required: true,
altersDynamicFields: false,
},

...]
],
sample: {'name': 'Bob Ross'},
outputFields: p{"key": 'artist_id', "type": "integer"},
{"key": 'name', "type": "string"},
],
perform: performCreate,
}
},
};

 

Be the first to reply!

Reply