RDAP: Include remarks only in object classes

The APNIC conformance checker points out that, according to RFC 7483,
RDAP remarks should be included only as part of object classes such as
domains, nameservers and entities, not in help responses and so on.

Note that something is amiss here -- If RFC 7483 is read strictly, the
remarks boilerplate for domain, nameserver and entity search results
should appear not at the top level, as we currently do, but as part of
each constituent object. However, the conformance checker does not
seem to complain about that. So I have added this to the RDAP questions
list, and am leaving the boilerplate at the top level for now.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117557594
This commit is contained in:
mountford 2016-03-18 10:04:36 -07:00 committed by Justine Tunney
parent c8d655e416
commit c25cfa626b
8 changed files with 26 additions and 41 deletions

View file

@ -99,7 +99,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
} }
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>(); ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("entitySearchResults", results); builder.put("entitySearchResults", results);
RdapJsonFormatter.addTopLevelEntries(builder, BoilerplateType.OTHER, null, rdapLinkBase); RdapJsonFormatter.addTopLevelEntries(builder, BoilerplateType.ENTITY, null, rdapLinkBase);
return builder.build(); return builder.build();
} }

View file

@ -68,7 +68,7 @@ public class RdapIcannStandardInformation {
ImmutableList.of( ImmutableList.of(
CONFORMANCE_REMARK, DOMAIN_STATUS_CODES_REMARK, INACCURACY_COMPLAINT_FORM_REMARK); CONFORMANCE_REMARK, DOMAIN_STATUS_CODES_REMARK, INACCURACY_COMPLAINT_FORM_REMARK);
/** Boilerplate remarks required by non-domain responses. */ /** Boilerplate remarks required by nameserver and entity responses. */
static final ImmutableList<ImmutableMap<String, Object>> nonDomainBoilerplateRemarks = static final ImmutableList<ImmutableMap<String, Object>> nameserverAndEntityBoilerplateRemarks =
ImmutableList.of(CONFORMANCE_REMARK); ImmutableList.of(CONFORMANCE_REMARK);
} }

View file

@ -77,12 +77,16 @@ import javax.annotation.Nullable;
public class RdapJsonFormatter { public class RdapJsonFormatter {
/** /**
* What type of boilerplate notices are required for the RDAP JSON messages? The ICANN RDAP * Indication of what type of boilerplate notices are required for the RDAP JSON messages. The
* Profile specifies that, for instance, domain name responses should include a remark about * ICANN RDAP Profile specifies that, for instance, domain name responses should include a remark
* domain status codes. So we need to know when to include such boilerplate. * about domain status codes. So we need to know when to include such boilerplate. On the other
* hand, remarks are not allowed except in domain, nameserver and entity objects, so we need to
* suppress them for other types of responses (e.g. help).
*/ */
public enum BoilerplateType { public enum BoilerplateType {
DOMAIN, DOMAIN,
NAMESERVER,
ENTITY,
OTHER OTHER
} }
@ -279,9 +283,17 @@ public class RdapJsonFormatter {
noticesBuilder.add(tosNotice); noticesBuilder.add(tosNotice);
} }
builder.put(NOTICES, noticesBuilder.build()); builder.put(NOTICES, noticesBuilder.build());
builder.put(REMARKS, (boilerplateType == BoilerplateType.DOMAIN) switch (boilerplateType) {
? RdapIcannStandardInformation.domainBoilerplateRemarks case DOMAIN:
: RdapIcannStandardInformation.nonDomainBoilerplateRemarks); builder.put(REMARKS, RdapIcannStandardInformation.domainBoilerplateRemarks);
break;
case NAMESERVER:
case ENTITY:
builder.put(REMARKS, RdapIcannStandardInformation.nameserverAndEntityBoilerplateRemarks);
break;
default: // things other than domains, nameservers and entities cannot contain remarks
break;
}
} }
/** AutoValue class to build parameters to {@link #makeRdapJsonNotice}. */ /** AutoValue class to build parameters to {@link #makeRdapJsonNotice}. */
@ -507,7 +519,7 @@ public class RdapJsonFormatter {
builder.put("port43", whoisServer); builder.put("port43", whoisServer);
} }
if (isTopLevel) { if (isTopLevel) {
addTopLevelEntries(builder, BoilerplateType.OTHER, null, linkBase); addTopLevelEntries(builder, BoilerplateType.NAMESERVER, null, linkBase);
} }
return builder.build(); return builder.build();
} }
@ -576,7 +588,7 @@ public class RdapJsonFormatter {
builder.put("port43", whoisServer); builder.put("port43", whoisServer);
} }
if (isTopLevel) { if (isTopLevel) {
addTopLevelEntries(builder, BoilerplateType.OTHER, null, linkBase); addTopLevelEntries(builder, BoilerplateType.ENTITY, null, linkBase);
} }
return builder.build(); return builder.build();
} }
@ -656,7 +668,7 @@ public class RdapJsonFormatter {
builder.put("port43", whoisServer); builder.put("port43", whoisServer);
} }
if (isTopLevel) { if (isTopLevel) {
addTopLevelEntries(builder, BoilerplateType.OTHER, null, linkBase); addTopLevelEntries(builder, BoilerplateType.ENTITY, null, linkBase);
} }
return builder.build(); return builder.build();
} }

View file

@ -107,7 +107,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
} }
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>(); ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("nameserverSearchResults", results); builder.put("nameserverSearchResults", results);
RdapJsonFormatter.addTopLevelEntries(builder, BoilerplateType.OTHER, null, rdapLinkBase); RdapJsonFormatter.addTopLevelEntries(builder, BoilerplateType.NAMESERVER, null, rdapLinkBase);
return builder.build(); return builder.build();
} }

View file

@ -45,14 +45,5 @@
} }
] ]
} }
],
"remarks" :
[
{
"description" :
[
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
]
}
] ]
} }

View file

@ -27,14 +27,5 @@
} }
] ]
} }
],
"remarks" :
[
{
"description" :
[
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
]
}
] ]
} }

View file

@ -31,14 +31,5 @@
} }
] ]
} }
],
"remarks" :
[
{
"description" :
[
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
]
}
] ]
} }