Skip to content

V3 Work#48

Draft
dcarbone wants to merge 116 commits intomainfrom
dcarbone/v3
Draft

V3 Work#48
dcarbone wants to merge 116 commits intomainfrom
dcarbone/v3

Conversation

@dcarbone
Copy link
Copy Markdown
Owner

@dcarbone dcarbone commented Apr 11, 2025

Goals:

  • Remove useless comments.
  • Remove FakeMap class.
  • Remove FakeSlice class.
  • Remove ScalarType interface.
  • Use parameterized constructors for all models.
  • Remove Transcoding type and usage.
  • Remove Unmarshaller and Marshaller traits and flow.
  • Localize entirety of json encoding / decoding to each individual model class.
  • Better support for dynamically declared fields.
  • Enable all Time\Duration values to accept null|int|float|string|\DateInterval|Time\Duration for construction.
  • Create enum types for enum values.

@dcarbone dcarbone changed the title working on v3 V3 Work Apr 11, 2025
@dcarbone dcarbone requested a review from Copilot April 11, 2025 02:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 32 out of 51 changed files in this pull request and generated 2 comments.

Files not reviewed (19)
  • src/ACL/ACLAuthMethod.php: Language not supported
  • src/ACL/ACLAuthMethodListEntry.php: Language not supported
  • src/ACL/ACLAuthMethodListEntryQueryResponse.php: Language not supported
  • src/ACL/ACLAuthMethodNamespaceRule.php: Language not supported
  • src/ACL/ACLAuthMethodQueryResponse.php: Language not supported
  • src/ACL/ACLAuthMethodWriteResponse.php: Language not supported
  • src/ACL/ACLBindingRule.php: Language not supported
  • src/ACL/ACLBindingRuleQueryResponse.php: Language not supported
  • src/ACL/ACLBindingRuleWriteResponse.php: Language not supported
  • src/ACL/ACLBindingRulesQueryResponse.php: Language not supported
  • src/ACL/ACLClient.php: Language not supported
  • src/ACL/ACLEntriesResponse.php: Language not supported
  • src/ACL/ACLEntry.php: Language not supported
  • src/ACL/ACLLink.php: Language not supported
  • src/ACL/ACLLoginParams.php: Language not supported
  • src/ACL/ACLNodeIdentity.php: Language not supported
  • src/ACL/ACLOIDCAuthURLParams.php: Language not supported
  • src/ACL/ACLOIDCCallbackParams.php: Language not supported
  • src/ACL/ACLPolicy.php: Language not supported
Comments suppressed due to low confidence (1)

README.md:106

  • There appears to be an extra closing bracket in the client instantiation, which may lead to a syntax error in the example code. Consider removing the extra bracket.
$proxyClient = new \GuzzleHttp\Client(['proxy' => 'whatever proxy you want']]);

@dcarbone dcarbone requested a review from Copilot April 11, 2025 03:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 41 out of 60 changed files in this pull request and generated 1 comment.

Files not reviewed (19)
  • src/ACL/ACLAuthMethod.php: Language not supported
  • src/ACL/ACLAuthMethodListEntry.php: Language not supported
  • src/ACL/ACLAuthMethodListEntryQueryResponse.php: Language not supported
  • src/ACL/ACLAuthMethodNamespaceRule.php: Language not supported
  • src/ACL/ACLAuthMethodQueryResponse.php: Language not supported
  • src/ACL/ACLAuthMethodWriteResponse.php: Language not supported
  • src/ACL/ACLBindingRule.php: Language not supported
  • src/ACL/ACLBindingRuleQueryResponse.php: Language not supported
  • src/ACL/ACLBindingRuleWriteResponse.php: Language not supported
  • src/ACL/ACLBindingRulesQueryResponse.php: Language not supported
  • src/ACL/ACLClient.php: Language not supported
  • src/ACL/ACLEntriesResponse.php: Language not supported
  • src/ACL/ACLEntry.php: Language not supported
  • src/ACL/ACLLink.php: Language not supported
  • src/ACL/ACLLoginParams.php: Language not supported
  • src/ACL/ACLNodeIdentity.php: Language not supported
  • src/ACL/ACLOIDCAuthURLParams.php: Language not supported
  • src/ACL/ACLOIDCCallbackParams.php: Language not supported
  • src/ACL/ACLPolicy.php: Language not supported
Comments suppressed due to low confidence (1)

README.md:106

  • An extra closing bracket appears in the instantiation of \GuzzleHttp\Client, which may result in a syntax error. Please remove the additional bracket.
$proxyClient = new \GuzzleHttp\Client(['proxy' => 'whatever proxy you want']]);

@dcarbone dcarbone self-assigned this Apr 14, 2025
@dcarbone dcarbone requested a review from Copilot April 9, 2026 23:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 158 out of 555 changed files in this pull request and generated 12 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


public function jsonSerialize(): \stdClass
{
$out = $this->_startJsonSerialize();
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsonSerialize() currently returns an empty object and does not include the Mode field at all, which will silently drop data on encode. Serialize Mode (likely as $this->Mode->value, consistent with other enum-backed fields) and omit it only when it is MeshGatewayMode::Default if that's the desired behavior.

Suggested change
$out = $this->_startJsonSerialize();
$out = $this->_startJsonSerialize();
if (MeshGatewayMode::Default !== $this->Mode) {
$out->Mode = $this->Mode->value;
}

Copilot uses AI. Check for mistakes.
Comment on lines +117 to +119
} elseif ('CipherSuites' === $k || 'cipher_suites' === $k) {
$n->setcipherSuites(...$v);
} elseif ('SDS' === $k) {
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method call uses the wrong casing (setcipherSuites) but the class defines setCipherSuites. In PHP this is a fatal error at runtime. Rename the call to setCipherSuites(...$v).

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +113
} elseif ('HashPolicies' === $k || 'hash_policies' === $k) {
if (null !== $v) {
foreach ($v as $hp) {
$n->HashPolicies[] = HashPolicy::jsonUnserialize($hp);
}
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$HashPolicies is declared as null|array and defaults to null, but jsonUnserialize() appends to it without initializing it to []. Appending to null will throw. Initialize $n->HashPolicies = []; before the inner loop (or call setHashPolicies(...)) when $v is non-null.

Copilot uses AI. Check for mistakes.
Comment on lines +151 to +153
if ('' !== $this->ServiceSubset) {
$out->service_subset = $this->ServiceSubset;
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON output for ServiceSubset and SamenessGroup uses snake_case keys (service_subset, sameness_group) while most other fields in this model are serialized with Consul's usual PascalCase (e.g., Service, Namespace, Datacenter). Earlier versions of this model (per removed FIELDS) also used ServiceSubset. Unless the API explicitly requires snake_case here, this change is likely a breaking change for consumers and/or Consul compatibility. Prefer consistent key casing (and if you need to accept both on input, keep the dual-handling in jsonUnserialize).

Copilot uses AI. Check for mistakes.
Comment on lines +166 to +168
if ('' !== $this->SamenessGroup) {
$out->sameness_group = $this->SamenessGroup;
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON output for ServiceSubset and SamenessGroup uses snake_case keys (service_subset, sameness_group) while most other fields in this model are serialized with Consul's usual PascalCase (e.g., Service, Namespace, Datacenter). Earlier versions of this model (per removed FIELDS) also used ServiceSubset. Unless the API explicitly requires snake_case here, this change is likely a breaking change for consumers and/or Consul compatibility. Prefer consistent key casing (and if you need to accept both on input, keep the dual-handling in jsonUnserialize).

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +67
foreach ((array)$decoded as $k => $v) {
if ('only_passing' === $k) {
$n->OnlyPassing = $v;
} else {
$n->{$k} = $v;
}
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The legacy field name for this property was OnlyPassing (PascalCase). jsonUnserialize() now only maps only_passing, so payloads containing OnlyPassing will no longer populate the property. If Consul returns/accepts OnlyPassing here (consistent with many other endpoints), this will break decoding. Consider accepting both (OnlyPassing and only_passing) similarly to other models in this PR.

Copilot uses AI. Check for mistakes.
foreach ($checkInfos as $checkInfo) {
$this->AgentServiceChecksInfos[] = AgentServiceChecksInfo::jsonUnserialize($checkInfo);
}
$this->Err = $err;
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class no longer uses the ErrorContainer trait (which previously defined $Err), but it still assigns $this->Err. If AbstractResponse does not define $Err, this will create a dynamic property (deprecated in PHP 8.2+ and potentially a runtime error depending on settings). Declare public null|Error $Err = null; here, or ensure the parent class defines it explicitly.

Copilot uses AI. Check for mistakes.
dcarbone and others added 4 commits April 9, 2026 18:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Daniel Carbone <daniel.p.carbone@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Daniel Carbone <daniel.p.carbone@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Daniel Carbone <daniel.p.carbone@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants