Skip to content

feat!: regenerate the SDK from the enhanced generator - #82

Open
mridang wants to merge 52 commits into
mainfrom
feat/better-enhanced-sdks
Open

mridang wants to merge 52 commits into
mainfrom
feat/better-enhanced-sdks

Conversation

@mridang

@mridang mridang commented Jun 13, 2026 •

Copy link
Copy Markdown
Collaborator

Regenerates the SDK from the enhanced openapi-generator-plus, with bespoke authenticators ported to the new interfaces and full unit + integration suites passing locally.

Closes #21
Closes #58

@mridang
mridang force-pushed the feat/better-enhanced-sdks branch from 06849e1 to fde8eea Compare June 13, 2026 11:28
@github-actions

github-actions Bot commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Qodana for PHP

2 new problems were found

Inspection name Severity Problems
Undefined function 🔶 Warning 1
Redundant cast to string ◽️ Notice 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@mridang
mridang force-pushed the feat/better-enhanced-sdks branch 2 times, most recently from a17022e to 5b7276b Compare June 13, 2026 13:19
@mridang mridang changed the title feat: regenerate SDK from enhanced generator with ported authenticators feat!: regenerate the SDK from the enhanced generator Jun 13, 2026
@mridang
mridang force-pushed the feat/better-enhanced-sdks branch 9 times, most recently from bf254ab to ddf46c0 Compare June 14, 2026 13:59
@mridang
mridang requested a review from Copilot June 15, 2026 12:33
@mridang mridang self-assigned this Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Regenerate the client from openapi-generator-plus with modernized
templates, authenticators ported to the new interfaces, and house
tooling aligned to the generator's output.

BREAKING CHANGE: new generated API surface, a raised minimum runtime,
and updated dependencies; not source-compatible with the prior release.
Reorganize .openapi-generator-ignore into the shared eight-section layout
and sort each section alphabetically. Also fix the facade to use the
generated TransportOptions constructor instead of the removed
::defaults() helper.
Move the bespoke auth tests, ZitadelTest, and fixtures from test/ into
tests/ so there is a single test root matching the generator's emitted
unit tests. Wire mrpunyapal/peststan into phpstan.neon and drop the
test-dir exclusion so the suite is now statically analysed.
The twelve generators had drifted into twelve dialects describing the same
SDK. Each sentence now has one wording across every language, varying only in
a token the language genuinely calls by another name.
The package manifest declared MIT beside an Apache-2.0 LICENSE file. It is
maintained by hand, so the generator could not correct it; it now declares
Apache-2.0, and proc.yml records the same for the generated metadata.
Adds the network and timeout errors, drops the one-off error types and
keeps the Zitadel root name through errorPrefix.
OpenID discovery and token requests now run lazily through the injected
ApiClient. Caller mistakes raise the built-in argument or state error, a
rejected token request OAuth2Server, an unusable token response OAuth2Token.
The private-key spec now uses the local stack instead of zitadel.cloud.
Every SDK error now lives in Zitadel\Client\Errors, so the hand-written auth,
tests and specs import from there. Drop the local OAuth2 exception copies now
that the generator always emits them, and let OpenId discovery raise through
ApiException::fromResponse instead of keeping its own status table.

Add the open-telemetry/sdk dev dependency and the proxy-auth fixture the
regenerated transport tests need.
The repo carried no contributor guidance, so the keep-list, the error
contract and where a fix belongs were only discoverable by reading code.
Errors, client contract and configuration now match the other eleven
languages; the process-wide default configuration is gone.
The generator now records which dev dependencies its tests import, and
this repo keeps its own package manifest, so the two must stay in step.
…anifest

The generator now records which dev dependencies its tests import, and its
linter configs apply to the generated tree instead of being kept locally.
Wait for both 3128 and 3129 to listen before reading their mapped ports so the
bootstrap no longer aborts on an empty getMappedPort(3129), and add the 407 and
credentialed proxy tests.
…ts auth port

The proxy fixture failed in CI: squid's auth port (3129) never became
available, so both the ZitadelTest suite and the Setup bootstrap timed out.
ubuntu/squid declares VOLUME /var/log/squid and /var/spool/squid and drops to
the unprivileged proxy user before opening its logs; the other SDKs mount both
as tmpfs so the log daemon can start. testcontainers-php has no tmpfs helper,
so the container is extended with one to match the siblings.

The port read now blocks on squid's own "authport" readiness line instead of a
hand-rolled inspect poll, which also removes the getMappedPort-on-null and
Docker-inspect union-type errors that failed phpstan.
Waiting on squid's readiness log was not enough: getMappedPort() memoises the
first inspect it reads, and on CI that snapshot is taken while the container is
already running but before Docker has surfaced the published host ports, so the
mapped port stayed empty and aborted the suite. Poll a fresh
StartedGenericContainer each iteration until both ports are published and
accepting connections; the tmpfs mounts keep squid alive so the bindings
actually appear. Squid's logs are surfaced if the ports never do.
Squid is confirmed up on both ports in CI, but the mapped-port wait still times
out. Record whether getMappedPort returned a host port and whether that port
accepts a TCP connection, so the failure says which of the two it is instead of
only dumping squid's logs.
The root cause of the CI-only proxy failure: testcontainers-php sets host
PortBindings but never Config.ExposedPorts, so the daemon only publishes ports
the image already EXPOSEs. ubuntu/squid exposes 3128 but not the 3129 auth port,
so on CI's strict daemon the 3129 binding was dropped (getMappedPort returned
empty); local Docker Desktop published it anyway, which hid the bug.

Override createContainerConfig to expose every requested port. An empty
ExposedPorts item serialises to [] and the daemon wants {}, so a single ignored
entry forces object serialisation.
…y diagnostics

The 407 test asserted the base ApiException; tighten it to ClientException, the
4xx bucket the transport actually raises, matching the other SDKs. Drop the
one-off dumpPorts diagnostic and verbose state string so the port wait matches
the lean helper in spec/Setup.php.
…rounds

The proxy fixture pinned testcontainers 1.0.8, which lacked withTmpfs and
serialised an empty ExposedPorts item as [] (the daemon wants {}). That forced a
hand-rolled tmpfs Mount and a dummy-key ContainerConfigExposedPortsItem. 1.1.0
adds withTmpfs and wraps ExposedPorts values in a JsonObject, so both fixtures
now use native withTmpfs and set ExposedPorts to empty arrays, matching the
generator's golden bootstrap. Behaviour is unchanged; the suite still passes.
Setup started a wiremock+squid proxy and published PROXY_URL/PROXY_AUTH_URL, but
nothing reads them: ZitadelTest starts its own containers and the sanity specs
do not use a proxy. So the unit suite stood up two proxies and used one. Remove
the dead fixture so the extension only loads .env and wires the JUnit reporter,
leaving ZitadelTest's setUpBeforeClass as the single place that manages the
proxy containers, matching the java, dotnet, ruby and node SDKs.
composer test filtered to --testsuite unit, so the docker-compose-backed
sanity specs (Session/User service checks) never ran in CI even though the
Setup bootstrap and AbstractIntegrationTest bring the stack up themselves.
Run both suites like the other SDKs' single test command does.
@mridang
mridang force-pushed the feat/better-enhanced-sdks branch from ecc7a59 to dfc84ac Compare September 28, 2026 00:37
Rename the four sanity-check tests to the concise form the other SDKs
use so all six read line for line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release SDK for V5 Fixed the messy auto-generated serde logic in the library

2 participants