From 5887a68965152ecb22eae1041606968d40092d08 Mon Sep 17 00:00:00 2001 From: Koen Hendriks Date: Mon, 4 May 2026 10:00:50 +0200 Subject: [PATCH 1/2] Add test for `.com` TLD API nullable fields configuration. confirming bug. --- tests/Clients/Domains/TLDsApiInfoTest.php | 16 ++++ tests/Domain/data/tldinfo_com-nullables.json | 89 ++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 tests/Domain/data/tldinfo_com-nullables.json diff --git a/tests/Clients/Domains/TLDsApiInfoTest.php b/tests/Clients/Domains/TLDsApiInfoTest.php index 777173a..50f30b6 100644 --- a/tests/Clients/Domains/TLDsApiInfoTest.php +++ b/tests/Clients/Domains/TLDsApiInfoTest.php @@ -33,6 +33,22 @@ public function test_info_com(): void Assert::assertSame(113, $languageCodes->count()); } + public function test_info_com_nullables(): void + { + $json = file_get_contents(__DIR__ . '/../../Domain/data/tldinfo_com-nullables.json'); + + assert(is_string($json)); + + $sdk = MockedClientFactory::makeSdk( + 200, + $json, + MockedClientFactory::assertRoute('GET', 'v2/tlds/com/info', $this) + ); + + $response = $sdk->tlds->info('com'); + $this->assertInstanceOf(TLDInfo::class, $response); + } + public function test_info_nl(): void { $json = file_get_contents(__DIR__ . '/../../Domain/data/tldinfo_nl.json'); diff --git a/tests/Domain/data/tldinfo_com-nullables.json b/tests/Domain/data/tldinfo_com-nullables.json new file mode 100644 index 0000000..2d4d8f5 --- /dev/null +++ b/tests/Domain/data/tldinfo_com-nullables.json @@ -0,0 +1,89 @@ +{ + "metadata": { + "renewDomainPeriods": [ + 12, + 24, + 36, + 48, + 60, + 72, + 84, + 96, + 108, + 120 + ], + "whoisExposure": "FULL", + "gdprCategory": "UNKNOWN", + "createDomainPeriods": [ + 12, + 24, + 36, + 48, + 60, + 72, + 84, + 96, + 108, + 120 + ], + "autoRenewDomainPeriods": [ + 12 + ], + "registrant": { + "organizationRequired": false, + "organizationAllowed": true + }, + "adjustableAuthCode": true, + "creationRequiresPreValidation": false, + "transferFOA": true, + "featuresAvailable": [ + "RESTORE", + "CREATE", + "PRIVACY_PROTECT", + "RENEW", + "TRANSFER", + "UPDATE" + ], + "customAuthcodeSupport": true, + "adminContacts": { + "min": 1, + "max": 10, + "required": true, + "organizationRequired": false, + "organizationAllowed": true + }, + "billingContacts": { + "min": 0, + "max": 10, + "required": false, + "organizationRequired": false, + "organizationAllowed": true + }, + "techContacts": { + "min": 1, + "max": 10, + "required": true, + "organizationRequired": false, + "organizationAllowed": true + }, + "nameservers": { + "min": 0, + "max": 10, + "required": false + }, + "domainSyntax": { + "minLength": 3, + "maxLength": 63, + "idnType": "UTS46", + "idnSupport": true + }, + "transferRequiresAuthcode": true, + "transferSupportsAuthcode": true, + "registrantChangeApprovalRequired": true + }, + "provider": "Verisign", + "applicableFor": [ + "com", + "net" + ] +} From 91f16a4628aa615c817c4aafee440fad90fe9c2b Mon Sep 17 00:00:00 2001 From: Koen Hendriks Date: Mon, 4 May 2026 10:02:04 +0200 Subject: [PATCH 2/2] Update `TLDMetaData` to allow nullable fields for premium support and notifications --- src/Domain/TLDMetaData.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Domain/TLDMetaData.php b/src/Domain/TLDMetaData.php index fb26684..3212458 100644 --- a/src/Domain/TLDMetaData.php +++ b/src/Domain/TLDMetaData.php @@ -76,7 +76,7 @@ final class TLDMetaData implements DomainObjectInterface public string $gdprCategory; - public string $premiumSupport; + public ?string $premiumSupport; public DomainSyntax $domainSyntax; @@ -94,9 +94,9 @@ final class TLDMetaData implements DomainObjectInterface public ?LaunchPhaseCollection $launchPhases; - public bool $wdrpNotifications; + public ?bool $wdrpNotifications; - public bool $errpNotifications; + public ?bool $errpNotifications; public ?int $transferLockDays; @@ -139,9 +139,9 @@ private function __construct( ?string $jurisdiction, ?string $termsOfService, ?string $privacyPolicy, - string $premiumSupport, - bool $wdrpNotifications, - bool $errpNotifications, + ?string $premiumSupport, + ?bool $wdrpNotifications, + ?bool $errpNotifications, ?int $transferLockDays ) { $this->createDomainPeriods = $createDomainPeriods; @@ -204,7 +204,10 @@ public static function fromArray(array $json): TLDMetaData } WhoisExposureEnum::validate($json['whoisExposure']); GDPRCategoryEnum::validate($json['gdprCategory']); - PremiumSupportEnum::validate($json['premiumSupport']); + + if (isset($json['premiumSupport'])) { + PremiumSupportEnum::validate($json['premiumSupport']); + } return new TLDMetaData( $json['createDomainPeriods'], @@ -245,9 +248,9 @@ public static function fromArray(array $json): TLDMetaData $json['jurisdiction'] ?? null, $json['termsOfService'] ?? null, $json['privacyPolicy'] ?? null, - $json['premiumSupport'], - $json['wdrpNotifications'], - $json['errpNotifications'], + $json['premiumSupport'] ?? null, + $json['wdrpNotifications'] ?? null, + $json['errpNotifications'] ?? null, $json['transferLockDays'] ?? null ); }