convention_builder 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/index.js +8 -6
- package/dist/node/index.js +8 -6
- package/package.json +1 -1
package/dist/module/index.js
CHANGED
|
@@ -8792,8 +8792,10 @@ var require_schema_utilities = __commonJS({
|
|
|
8792
8792
|
return output;
|
|
8793
8793
|
}
|
|
8794
8794
|
__name(flattenObjectBranch, "flattenObjectBranch");
|
|
8795
|
+
var nameRegex = /[0-9a-zA-Z_]*$/;
|
|
8796
|
+
var overlayRegex = /[0-9a-zA-Z-_]*/;
|
|
8795
8797
|
function checkRequiredInSchema(path, schema) {
|
|
8796
|
-
let attributeName = path.match(
|
|
8798
|
+
let attributeName = path.match(nameRegex)[0];
|
|
8797
8799
|
let pathFormat = new RegExp(`properties.${attributeName}`).test(path);
|
|
8798
8800
|
if (!pathFormat) {
|
|
8799
8801
|
throw new Error(`Attribute paths have a format in which the second to last property is 'properties' such as 'properties.attributes.properties.date' for a field named 'date'. This one seems to have another format. Provided path is ${path} .`);
|
|
@@ -8830,14 +8832,14 @@ var require_schema_utilities = __commonJS({
|
|
|
8830
8832
|
let entry = {
|
|
8831
8833
|
path: attr,
|
|
8832
8834
|
path_simplified: attr.replace(/\.properties/g, "").replace(/properties\./, ""),
|
|
8833
|
-
name: attr.match(
|
|
8835
|
+
name: attr.match(nameRegex)[0],
|
|
8834
8836
|
required: isRequired
|
|
8835
8837
|
};
|
|
8836
8838
|
if (isConvention) {
|
|
8837
|
-
entry.overlay = entry.path_simplified.match(
|
|
8839
|
+
entry.overlay = entry.path_simplified.match(overlayRegex)[0];
|
|
8838
8840
|
}
|
|
8839
8841
|
;
|
|
8840
|
-
allFlattenedPaths.filter((d) => d.path.includes(`${attr}.`)).forEach((d) => {
|
|
8842
|
+
allFlattenedPaths.filter((d) => d.path.includes(`${attr}.`) && !d.path.includes("items")).forEach((d) => {
|
|
8841
8843
|
let key = d.path.replace(`${attr}.`, "");
|
|
8842
8844
|
let value = d.value;
|
|
8843
8845
|
entry[key] = value;
|
|
@@ -8849,10 +8851,10 @@ var require_schema_utilities = __commonJS({
|
|
|
8849
8851
|
let entry = {
|
|
8850
8852
|
path: rel,
|
|
8851
8853
|
path_simplified: rel.replace(/\.properties/g, "").replace(/properties\./, ""),
|
|
8852
|
-
name: rel.match(
|
|
8854
|
+
name: rel.match(nameRegex)[0]
|
|
8853
8855
|
};
|
|
8854
8856
|
if (isConvention) {
|
|
8855
|
-
entry.overlay = entry.path_simplified.match(
|
|
8857
|
+
entry.overlay = entry.path_simplified.match(overlayRegex)[0];
|
|
8856
8858
|
let relatedDataPaths = dig(
|
|
8857
8859
|
schema,
|
|
8858
8860
|
`${rel}.properties.data.contains.anyOf`
|
package/dist/node/index.js
CHANGED
|
@@ -8785,8 +8785,10 @@ var require_schema_utilities = __commonJS({
|
|
|
8785
8785
|
return output;
|
|
8786
8786
|
}
|
|
8787
8787
|
__name(flattenObjectBranch, "flattenObjectBranch");
|
|
8788
|
+
var nameRegex = /[0-9a-zA-Z_]*$/;
|
|
8789
|
+
var overlayRegex = /[0-9a-zA-Z-_]*/;
|
|
8788
8790
|
function checkRequiredInSchema(path, schema) {
|
|
8789
|
-
let attributeName = path.match(
|
|
8791
|
+
let attributeName = path.match(nameRegex)[0];
|
|
8790
8792
|
let pathFormat = new RegExp(`properties.${attributeName}`).test(path);
|
|
8791
8793
|
if (!pathFormat) {
|
|
8792
8794
|
throw new Error(`Attribute paths have a format in which the second to last property is 'properties' such as 'properties.attributes.properties.date' for a field named 'date'. This one seems to have another format. Provided path is ${path} .`);
|
|
@@ -8823,14 +8825,14 @@ var require_schema_utilities = __commonJS({
|
|
|
8823
8825
|
let entry = {
|
|
8824
8826
|
path: attr,
|
|
8825
8827
|
path_simplified: attr.replace(/\.properties/g, "").replace(/properties\./, ""),
|
|
8826
|
-
name: attr.match(
|
|
8828
|
+
name: attr.match(nameRegex)[0],
|
|
8827
8829
|
required: isRequired
|
|
8828
8830
|
};
|
|
8829
8831
|
if (isConvention) {
|
|
8830
|
-
entry.overlay = entry.path_simplified.match(
|
|
8832
|
+
entry.overlay = entry.path_simplified.match(overlayRegex)[0];
|
|
8831
8833
|
}
|
|
8832
8834
|
;
|
|
8833
|
-
allFlattenedPaths.filter((d) => d.path.includes(`${attr}.`)).forEach((d) => {
|
|
8835
|
+
allFlattenedPaths.filter((d) => d.path.includes(`${attr}.`) && !d.path.includes("items")).forEach((d) => {
|
|
8834
8836
|
let key = d.path.replace(`${attr}.`, "");
|
|
8835
8837
|
let value = d.value;
|
|
8836
8838
|
entry[key] = value;
|
|
@@ -8842,10 +8844,10 @@ var require_schema_utilities = __commonJS({
|
|
|
8842
8844
|
let entry = {
|
|
8843
8845
|
path: rel,
|
|
8844
8846
|
path_simplified: rel.replace(/\.properties/g, "").replace(/properties\./, ""),
|
|
8845
|
-
name: rel.match(
|
|
8847
|
+
name: rel.match(nameRegex)[0]
|
|
8846
8848
|
};
|
|
8847
8849
|
if (isConvention) {
|
|
8848
|
-
entry.overlay = entry.path_simplified.match(
|
|
8850
|
+
entry.overlay = entry.path_simplified.match(overlayRegex)[0];
|
|
8849
8851
|
let relatedDataPaths = dig(
|
|
8850
8852
|
schema,
|
|
8851
8853
|
`${rel}.properties.data.contains.anyOf`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "convention_builder",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Helper tools that offer a high level interface that transforms a convention description into it's json schema.",
|
|
5
5
|
"main": "./dist/node/index.js",
|
|
6
6
|
"browser": "./dist/browser/index.js",
|