@journeyapps/parser-schema
Advanced tools
Comparing version 0.0.0-dev.72f4b3c.b2eab5e to 0.0.0-dev.9a029d5.d4cae18
@@ -29,3 +29,3 @@ import { Type } from './Type'; | ||
webhooks: any[]; | ||
notifyUsers: any[]; | ||
notifyUsers: NotificationConfig[]; | ||
sourceElement: XMLElement; | ||
@@ -61,1 +61,7 @@ constructor(name?: string); | ||
} | ||
export interface NotificationConfig { | ||
message: FormatString; | ||
recipient: string; | ||
received: string; | ||
badgeCount: string; | ||
} |
@@ -10,4 +10,3 @@ "use strict"; | ||
const parser_common_1 = require("@journeyapps/parser-common"); | ||
const RESERVED_NAMES = ['object', 'account', 'id', 'type']; | ||
const RESERVED_FIELD_NAMES = ['_id', '_type', 'account_id', 'attribute']; | ||
const reservedNames_1 = require("./reservedNames"); | ||
function parseElement(element, definitions, errorHandler) { | ||
@@ -255,4 +254,8 @@ const result = xml.parseElement(element, definitions); | ||
object.label = getAttribute(element, 'label'); | ||
if (RESERVED_NAMES.indexOf(object.name) >= 0) { | ||
errorHandler.pushError(xml.attributeNode(element, 'name'), "Reserved object name '" + object.name + "'"); | ||
const validation = reservedNames_1.validateModelName(object.name); | ||
// Special case here: if name === null, we don't want to tell the user it's | ||
// a reserved name, since it's not specified at all. | ||
if (validation && object.name !== null) { | ||
errorHandler.pushError(xml.attributeNode(element, 'name'), validation == 'error' ? `Reserved model name '${object.name}'` : | ||
`'${object.name}' is reserved in some contexts and may cause issues.`, validation); | ||
} | ||
@@ -689,4 +692,5 @@ // the ordering of the elements (elements can share a number and be interchangeable) | ||
if (!isVariable) { | ||
if (RESERVED_NAMES.concat(RESERVED_FIELD_NAMES).indexOf(variable.name) >= 0) { | ||
errorHandler.pushError(xml.attributeNode(element, 'name'), "Reserved field name '" + variable.name + "'"); | ||
const validation = reservedNames_1.validateFieldName(variable.name); | ||
if (validation) { | ||
errorHandler.pushError(xml.attributeNode(element, 'name'), `Reserved field name '${variable.name}'`, validation); | ||
} | ||
@@ -693,0 +697,0 @@ else if (variable.name != null && variable.name.slice(-3) === '_id') { |
@@ -136,3 +136,3 @@ "use strict"; | ||
} | ||
// Implemented elsewwhere | ||
// Implemented elsewhere | ||
valueFromJSON(data) { | ||
@@ -139,0 +139,0 @@ throw new Error('Not implemented'); |
{ | ||
"name": "@journeyapps/parser-schema", | ||
"version": "0.0.0-dev.72f4b3c.b2eab5e", | ||
"version": "0.0.0-dev.9a029d5.d4cae18", | ||
"description": "Journey JS library", | ||
@@ -14,7 +14,7 @@ "main": "./dist/src/index.js", | ||
"dependencies": { | ||
"@journeyapps/core-xml": "0.0.0-dev.72f4b3c.b2eab5e", | ||
"@journeyapps/parser-common": "0.0.0-dev.72f4b3c.b2eab5e" | ||
"@journeyapps/core-xml": "0.0.0-dev.9a029d5.d4cae18", | ||
"@journeyapps/parser-common": "0.0.0-dev.9a029d5.d4cae18" | ||
}, | ||
"devDependencies": { | ||
"@journeyapps/core-test-helpers": "0.0.0-dev.72f4b3c.b2eab5e", | ||
"@journeyapps/core-test-helpers": "0.0.0-dev.9a029d5.d4cae18", | ||
"@journeyapps/domparser": "^0.3.0" | ||
@@ -26,3 +26,3 @@ }, | ||
], | ||
"gitHead": "12327a7b11d71b9fab7478c311de9b3765017b01" | ||
"gitHead": "d09b49de32f68cfa2a896d4e85c8a5e9f0c264e8" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
158535
47
2118
+ Added@journeyapps/core-xml@0.0.0-dev.9a029d5.d4cae18(transitive)
+ Added@journeyapps/evaluator@0.0.0-dev.9a029d5.d4cae18(transitive)
+ Added@journeyapps/parser-common@0.0.0-dev.9a029d5.d4cae18(transitive)
- Removed@journeyapps/core-xml@0.0.0-dev.72f4b3c.b2eab5e(transitive)
- Removed@journeyapps/evaluator@0.0.0-dev.72f4b3c.b2eab5e(transitive)
- Removed@journeyapps/parser-common@0.0.0-dev.72f4b3c.b2eab5e(transitive)