Skip to content

Commit

Permalink
Merge branch 'JMV-2958-crear-nuevas-actions' of https://github.com/ja…
Browse files Browse the repository at this point in the history
…nis-commerce/view-schema-validator into JMV-2958-crear-nuevas-actions
  • Loading branch information
Francisco committed May 18, 2023
2 parents 01ff59c + 0011d1c commit 8fb0118
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 36 deletions.
4 changes: 3 additions & 1 deletion lib/deprecation-validators/index.js
Expand Up @@ -4,10 +4,12 @@ const title = require('./title-deprecation');
const titleComponents = require('./title-components-deprecation');
const staticFilters = require('./static-filters-deprecation');
const pathQuery = require('./path-query-deprecation');
const remoteAction = require('./remoteActions-deprecation');

module.exports = {
title,
titleComponents,
staticFilters,
pathQuery
pathQuery,
remoteAction
};
21 changes: 21 additions & 0 deletions lib/deprecation-validators/remoteActions-deprecation.js
@@ -0,0 +1,21 @@
'use strict';

const { getDaysToRemoveFeatureMessage, isEdit } = require('../helpers');

module.exports = class RemoteActionsDeprecation {

static getDayToRemove() {
return '07/15/2023';
}

static getDeprecatedMessage() {

return `The property \`remoteActions\` is going to be deprecated. ${getDaysToRemoveFeatureMessage(this.getDayToRemove())}`;
}

static validate(schema) {

if(isEdit(schema))
return JSON.stringify(schema).indexOf('remoteActions') === -1;
}
};
2 changes: 1 addition & 1 deletion lib/schemas/common/actions.js
Expand Up @@ -22,7 +22,7 @@ module.exports = ({
},
{
required: [
'source', 'sourceEndpointParameters'
'source'
]
}
],
Expand Down
34 changes: 17 additions & 17 deletions tests/mocks/schemas/edit-with-actions.yml
Expand Up @@ -91,7 +91,7 @@ actions:
resolve: false
sourceEndpointParameters:
- name: status
target: query
target: queryString
value:
static: active
staticActions:
Expand Down Expand Up @@ -167,7 +167,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: active
targetField: fieldNameThree
Expand Down Expand Up @@ -260,7 +260,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1

Expand Down Expand Up @@ -599,7 +599,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1

Expand Down Expand Up @@ -786,7 +786,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1
source:
Expand All @@ -805,7 +805,7 @@ sections:
componentAttributes:
endpointParameters:
- name: id
target: query
target: queryString
value:
dynamic: userIds
source:
Expand Down Expand Up @@ -853,7 +853,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1

Expand All @@ -871,7 +871,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1
dataMapping:
Expand Down Expand Up @@ -1023,7 +1023,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1
valuesMapper:
Expand Down Expand Up @@ -1112,7 +1112,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1
valuesMapper:
Expand Down Expand Up @@ -1377,11 +1377,11 @@ sections:
value:
dynamic: statusId
- name: status
target: query
target: queryString
value:
static: 1
- name: status
target: query
target: queryString
value:
static:
id: "string"
Expand Down Expand Up @@ -1538,7 +1538,7 @@ sections:
value:
dynamic: statusId
- name: status
target: query
target: queryString
value:
static: 1
filesTypes:
Expand All @@ -1561,11 +1561,11 @@ sections:
value:
dynamic: statusId
- name: status
target: query
target: queryString
value:
static: 1
- name: status
target: query
target: queryString
value:
static:
id: string
Expand Down Expand Up @@ -1630,7 +1630,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1
includeDataFrom:
Expand Down Expand Up @@ -1858,7 +1858,7 @@ sections:
value:
dynamic: id
- name: status
target: query
target: queryString
value:
static: 1
- name: stepsExample
Expand Down
34 changes: 17 additions & 17 deletions tests/mocks/schemas/expected/edit-with-actions.json
Expand Up @@ -142,7 +142,7 @@
"sourceEndpointParameters": [
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": "active"
}
Expand Down Expand Up @@ -260,7 +260,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": "active"
}
Expand Down Expand Up @@ -400,7 +400,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -949,7 +949,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -1251,7 +1251,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -1280,7 +1280,7 @@
"endpointParameters": [
{
"name": "id",
"target": "query",
"target": "queryString",
"value": {
"dynamic": "userIds"
}
Expand Down Expand Up @@ -1349,7 +1349,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -1379,7 +1379,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -1608,7 +1608,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -1735,7 +1735,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -2081,14 +2081,14 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": {
"id": "string"
Expand Down Expand Up @@ -2424,7 +2424,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -2453,14 +2453,14 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": {
"id": "string"
Expand Down Expand Up @@ -2547,7 +2547,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down Expand Up @@ -2943,7 +2943,7 @@
},
{
"name": "status",
"target": "query",
"target": "queryString",
"value": {
"static": 1
}
Expand Down

0 comments on commit 8fb0118

Please sign in to comment.