Skip to content

Commit 0c27de0

Browse files
committed
use lowercase vCard property names as they are always lowercase in jCard (closes #3)
1 parent a83edc9 commit 0c27de0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/rdap-validator.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ self.validateJCardPropertyType = function(property) {
704704
if (!property[0].toUpperCase().startsWith("X-")) {
705705
self.add(
706706
self.JCardPropertyTypes.includes(property[0].toUpperCase()),
707-
`Property type '${property[0]}' MUST be present in the IANA registry.`,
707+
"Property type '" + property[0].toLowerCase() + " MUST be present in the IANA registry.",
708708
);
709709
}
710710
};
@@ -777,7 +777,7 @@ self.validateJCardPropertyValue = function(property) {
777777
if (self.isString(property[0]) && "ADR" === property[0].toUpperCase() && self.isArray(property[3])) {
778778
self.add(
779779
7 == property[3].length,
780-
"Length of the array in an ADR property MUST be exactly 7.",
780+
"Length of the array in an 'adr' property MUST be exactly 7.",
781781
"section-6.3.1",
782782
);
783783

@@ -1788,12 +1788,12 @@ self.validateCommonGTLDResponseProperties = function(response) {
17881788
} else if ("ADR" == p[0].toUpperCase()) {
17891789
if (self.add(
17901790
Object.keys(p[1]).map((k) => k.toUpperCase()).includes("CC"),
1791-
"'ADR' properties of entity vCards MUST have a 'CC' parameter."
1791+
"'adr' properties of entity vCards MUST have a 'cc' parameter."
17921792
)) {
17931793
const cc = p[1][Object.keys(p[1]).filter((k) => "CC" == k.toUpperCase()).shift()];
17941794
self.add(
17951795
self.countryCodes.includes(cc),
1796-
"'CC' parameter '" + cc + "' MUST be a valid ISO 3166-alpha-2 code."
1796+
"'cc' parameter '" + cc + "' MUST be a valid ISO 3166-alpha-2 code."
17971797
);
17981798
}
17991799

@@ -1802,15 +1802,15 @@ self.validateCommonGTLDResponseProperties = function(response) {
18021802
if (
18031803
self.add(
18041804
self.isArray(p[3]),
1805-
"Value of an 'ADR' property MUST be an array."
1805+
"Value of an 'adr' property MUST be an array."
18061806
) &&
18071807
7 == p[3].length
18081808
) {
18091809
self.pushPath("[6]");
18101810

18111811
self.add(
18121812
p[3][6] == "",
1813-
"The last item of structured address in an 'ADR' property value MUST be empty."
1813+
"The last item of structured address in an 'adr' property value MUST be empty."
18141814
);
18151815

18161816
self.popPath("[6]");
@@ -2342,12 +2342,12 @@ self.validateGTLDEntity = function(rar) {
23422342
const keys = Object.keys(p[1]).map((k) => k.toUpperCase());
23432343
if (self.add(
23442344
keys.includes("CC"),
2345-
"JCard 'ADR' property MUST include a 'CC' parameter."
2345+
"JCard 'adr' property MUST include a 'cc' parameter."
23462346
)) {
23472347
const k = keys.filter((k) => "CC" == k.toUpperCase()).shift();
23482348
self.add(
23492349
self.countryCodes.includes(p[1][k]),
2350-
"JCard 'ADR' 'CC' parameter MUST be a valid ISO-3166-alpha2 code."
2350+
"JCard 'adr' 'cc' parameter MUST be a valid ISO-3166-alpha2 code."
23512351
);
23522352
}
23532353

@@ -2368,13 +2368,13 @@ self.validateGTLDEntity = function(rar) {
23682368
p[3][2].filter((s) => s.length > 0).length > 0
23692369
)
23702370
),
2371-
"JCard 'ADR' MUST include a Street address."
2371+
"JCard 'adr' MUST include a Street address."
23722372
);
23732373

23742374

23752375
self.add(
23762376
self.isString(p[3][3]) && p[3][3].length > 0,
2377-
"JCard 'ADR' MUST include a City."
2377+
"JCard 'adr' MUST include a City."
23782378
);
23792379

23802380
self.popPath("[3]");
@@ -2386,7 +2386,7 @@ self.validateGTLDEntity = function(rar) {
23862386

23872387
["FN", "ADR", "TEL", "EMAIL"].forEach((p) => self.add(
23882388
seen_types.hasOwnProperty(p),
2389-
"Registrar entity JCard MUST contain a '" + p + "' property."
2389+
"Registrar entity JCard MUST contain a '" + p.toLowerCase() + "' property."
23902390
));
23912391

23922392
self.popPath(".vcardArray[1]");

0 commit comments

Comments
 (0)