Skip to content

Commit

Permalink
Agregada validacion para no permitir keys nuevas cuando no hay type
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco committed Aug 4, 2023
1 parent 1350110 commit 39d6514
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
60 changes: 60 additions & 0 deletions lib/schemas/edit-new/modules/components/input.js
Expand Up @@ -33,6 +33,21 @@ module.exports = makeComponent({
}
}
},
{
if: {
properties: {
type: { const: false }
}
},
then: {
not: {
properties: {
minValue: { type: 'number' }
},
required: ['minValue']
}
}
},
{
if: {
not: {
Expand All @@ -50,6 +65,21 @@ module.exports = makeComponent({
}
}
},
{
if: {
properties: {
type: { const: false }
}
},
then: {
not: {
properties: {
maxValue: { type: 'number' }
},
required: ['maxValue']
}
}
},
{
if: {
not: {
Expand All @@ -67,6 +97,21 @@ module.exports = makeComponent({
}
}
},
{
if: {
properties: {
type: { const: false }
}
},
then: {
not: {
properties: {
minValueField: { type: 'string' }
},
required: ['minValueField']
}
}
},
{
if: {
not: {
Expand All @@ -84,6 +129,21 @@ module.exports = makeComponent({
}
}
},
{
if: {
properties: {
type: { const: false }
}
},
then: {
not: {
properties: {
maxValueField: { type: 'string' }
},
required: ['maxValueField']
}
}
},
{
if: {
properties: { minValue: { const: false } }
Expand Down
1 change: 1 addition & 0 deletions tests/mocks/schemas/new-with-min-max-input.yml
Expand Up @@ -23,5 +23,6 @@ sections:
options:
length: 50
componentAttributes:
type: 'number'
minValueField: '5'
maxValue: 5

0 comments on commit 39d6514

Please sign in to comment.