@@ -4,24 +4,6 @@ const self = rdapValidator;
4
4
5
5
export default rdapValidator ;
6
6
7
- self . referenceBase = "https://validator.rdap.org/specs/" ;
8
-
9
- self . referenceURLs = {
10
- "rfc7480" : "vanilla/rfc7480.html" ,
11
- "rfc7481" : "vanilla/rfc7481.html" ,
12
- "rfc9082" : "vanilla/rfc9082.html" ,
13
- "rfc9083" : "vanilla/rfc9083.html" ,
14
- "rfc9224" : "vanilla/rfc9224.html" ,
15
- "rfc9537" : "vanilla/rfc9537.html" ,
16
- "feb24-rp" : "gtld/2024-02/rdap-response-profile-21feb24-en.pdf" ,
17
- "feb24-tig" : "gtld/2024-02/rdap-technical-implementation-guide-21feb24-en.pdf" ,
18
- "nro" : "rir/2021-01/nro-rdap-profile.txt" ,
19
- } ;
20
-
21
- self . ref = function ( f , spec = null ) {
22
- return self . referenceBase + self . referenceURLs [ spec ?? self . currentSpec ] + "#" + f ;
23
- }
24
-
25
7
/**
26
8
* Initiate a test run.
27
9
* @param {null|string } url
@@ -272,6 +254,7 @@ self.validateNotices = function(notices) {
272
254
if ( self . add (
273
255
self . isArray ( notices ) ,
274
256
"The 'notices' property MUST be an array." ,
257
+ "section-4.3" ,
275
258
) ) {
276
259
self . iterate (
277
260
notices ,
@@ -291,17 +274,20 @@ self.validateObjectClassName = function(record, type) {
291
274
292
275
if ( ! self . add (
293
276
record . hasOwnProperty ( "objectClassName" ) ,
294
- "Record MUST have the 'objectClassName' property."
277
+ "Record MUST have the 'objectClassName' property." ,
278
+ "section-4.9"
295
279
) ) return ;
296
280
297
281
if ( ! self . add (
298
282
self . isString ( record . objectClassName ) ,
299
- "The 'objectClassName' property MUST be a string."
283
+ "The 'objectClassName' property MUST be a string." ,
284
+ "section-4.9"
300
285
) ) return ;
301
286
302
287
self . add (
303
288
type == record . objectClassName ,
304
- "The value of the 'objectClassName' property ('" + record . objectClassName + "') MUST be '" + type + "'."
289
+ "The value of the 'objectClassName' property ('" + record . objectClassName + "') MUST be '" + type + "'." ,
290
+ self . objectClassNameReferences [ type ] ,
305
291
) ;
306
292
307
293
self . popPath ( ".objectClassName" ) ;
@@ -2523,3 +2509,41 @@ self.add = function(result, message, ref) {
2523
2509
self . addMessage = function ( message ) {
2524
2510
self . add ( null , message ) ;
2525
2511
}
2512
+
2513
+ /**
2514
+ * base URL of all specifications
2515
+ */
2516
+ self . referenceBase = "https://validator.rdap.org/specs/" ;
2517
+
2518
+ /**
2519
+ * path segments for specifications
2520
+ */
2521
+ self . referenceURLs = {
2522
+ "rfc7480" : "vanilla/rfc7480.html" ,
2523
+ "rfc7481" : "vanilla/rfc7481.html" ,
2524
+ "rfc9082" : "vanilla/rfc9082.html" ,
2525
+ "rfc9083" : "vanilla/rfc9083.html" ,
2526
+ "rfc9224" : "vanilla/rfc9224.html" ,
2527
+ "rfc9537" : "vanilla/rfc9537.html" ,
2528
+ "feb24-rp" : "gtld/2024-02/rdap-response-profile-21feb24-en.pdf" ,
2529
+ "feb24-tig" : "gtld/2024-02/rdap-technical-implementation-guide-21feb24-en.pdf" ,
2530
+ "nro" : "rir/2021-01/nro-rdap-profile.txt" ,
2531
+ } ;
2532
+
2533
+ /**
2534
+ * section references for particular object types
2535
+ */
2536
+ self . objectClassNameReferences = {
2537
+ "entity" : "section-5.1" ,
2538
+ "nameserver" : "section-5.2" ,
2539
+ "domain" : "section-5.3" ,
2540
+ "ip network" : "section-5.4" ,
2541
+ "autnum" : "section-5.5" ,
2542
+ } ;
2543
+
2544
+ /**
2545
+ * generate a URL given the current specification and a fragment
2546
+ */
2547
+ self . ref = function ( fragment , alternateSpec = null ) {
2548
+ return self . referenceBase + self . referenceURLs [ alternateSpec ?? self . currentSpec ] + "#" + fragment ;
2549
+ }
0 commit comments