feat: add widgets schema validation (#3841)
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
import controlComponent from './SelectControl';
|
||||
import previewComponent from './SelectPreview';
|
||||
import schema from './schema';
|
||||
|
||||
const Widget = (opts = {}) => ({
|
||||
name: 'select',
|
||||
controlComponent,
|
||||
previewComponent,
|
||||
schema,
|
||||
...opts,
|
||||
});
|
||||
|
||||
|
24
packages/netlify-cms-widget-select/src/schema.js
Normal file
24
packages/netlify-cms-widget-select/src/schema.js
Normal file
@ -0,0 +1,24 @@
|
||||
export default {
|
||||
properties: {
|
||||
multiple: { type: 'boolean' },
|
||||
min: { type: 'integer' },
|
||||
max: { type: 'integer' },
|
||||
options: {
|
||||
type: 'array',
|
||||
items: {
|
||||
oneOf: [
|
||||
{ type: 'string' },
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
label: { type: 'string' },
|
||||
value: { type: 'string' },
|
||||
},
|
||||
required: ['label', 'value'],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
required: ['options'],
|
||||
};
|
Reference in New Issue
Block a user