Skip to content

feat: derive optional security from OpenAPI alternatives - #1891

Merged
ChiragAgg5k merged 2 commits into
mainfrom
clo-4377-optional
Sep 9, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
clo-4377-optional

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Owner-approved scope deferral

The owner approved deferring the remaining pre-existing schema issues and continuing this migration. Strict full-document validation still fails on the documented custom-array schemas; that failure is deferred, not fixed or passing. No additional schema-cleanup work is included in this rollout.

Proceed with the optional-security migration's review/CI and coordinated producer → Cloud/specs → generator release steps. Keep the temporary producer dependency pin and SDK compatibility/release sequencing explicit; this deferral is not approval to disable checks or merge unrelated fixes.


Latest verification — includes enum-default fix #13545 (now merged)

Cloud head 12abbfeab6fd35ddccb669cd43cf8d55eb407068 locks producer integration commit e36198300f0efe854d442526253ae2b7eab2c2fb, which includes #13545's code.

  • Both non-publishing workflows passed: 2.0.x, latest.
  • Artifacts are byte-identical: SHA256 eb9761f869119e57c2f01e3eca3ec12e5bcda9e87ec5bfc8f6750bc4190d1001.
  • Comparison against the preceding object-default-fixed artifacts shows exactly 15 invalid enum defaults removed, and no other parsed differences. Includes timezone, screenshot output, runtime/adapter, locale, encryption, password version, and region defaults.
  • Producer formatter suite passed: 41 tests, 244 assertions, plus targeted Pint.
  • Strict validation still fails on both artifacts: [] is not of type 'string'. The same failure category exists in the published document.
  • A recursive schema scan finds 10 string schemas with empty-array defaults: OAuth2 resource on authorize GET/POST, device authorization, PAR, and token; WAF conditions on bypass, challenge, deny, rate-limit, and redirect creation. Their source validators declare arrays (Multiple(..., TYPE_ARRAY) and WAF Conditions), but the producer's fallback maps them to string. Removing defaults alone would hide the underlying type mismatch.

No PRs merged by this verification, no spec publication or deployment. The release gate remains blocked on these custom-array schema mappings and the previously listed SDK compatibility checks. Earlier sections below are historical evidence.


Latest verification — includes merged #13544

Producer #13543 now includes main through f66db6e969 (merged object-default fix); head e4d63346abff7a70f04c820862b2d285e66b2595. Cloud #5716 locks that producer commit at Cloud head 6f68bc428.

  • Producer formatter tests: 39 tests, 222 assertions, passing; targeted Pint passes.
  • Cloud composer validate --no-check-publish passes; only the server-ce lock reference changed.
  • Non-publishing specs workflows passed: 2.0.x, latest.
  • Both artifacts are byte-identical: SHA256 a5fad5d320ab9592181451b7c479f5d85f603f6d895a829f353374fea81694bb.
  • Compared with the previous genuine candidate artifacts, exactly 16 defaults changed from [] to {}, with no other parsed differences. The optional-security migration is unchanged.
  • Strict openapi-spec-validator now gets past the empty-object-default failure but fails on screenshot timezone: GET /avatars/screenshots, parameter index 9, has default: "" outside its titled oneOf timezone enum. This field is unchanged from the previous artifact. Full spec validation remains blocked, not passing.
  • No specs were published or deployments performed. Historical verification below refers to earlier commits/artifacts; SDK output parity has not been rerun after the object-default fix.

Summary

Part of CLO-4377. Companion producer: appwrite/appwrite#13543.

  • Require utopia-php/openapi ^0.2.2 and lock 0.2.2, which provides accepted/required security scheme names.
  • Read accepted schemes across all alternatives for path bindings and operation security consumers instead of only security[0].
  • Omit optional example candidates using accepted-minus-required names. Preserve x-appwrite.auth as the separate source of example configuration, including candidates not referenced by API security.
  • Remove Appwrite::OPTIONAL and direct legacy extension checks from 17 example templates.
  • Extend the shared fixture and generated-output coverage for optional/required credentials, alternative order, anonymous access, no security, independent example config, and preserved client setters.

No OAuth scopes are merged. Generic security semantics live in OpenAPI 0.2.2, not in a generator helper.

Rollout gate

Do not release against the currently published old specs. Removing the legacy checks changes impersonation examples until the replacement security alternatives are published. Keep this draft until genuine Cloud generation, structural/live-spec baseline comparisons, and deployed-generator compatibility checks are complete. Coordinate producer promotion and canonical 2.0.x/latest publication before releasing this generator.

No Cloud promotion, specs publishing, or releases were performed.

Verification

Passing:

  • vendor/bin/phpunit --testsuite Generation — 91 tests, 1,154 assertions, 4 skipped.
  • vendor/bin/phpunit tests/e2e/PHP85Test.php — 1 test, 145 assertions against the Docker mock API.
  • composer refactor:check — passed.
  • composer lint-twig — 586 files, zero errors.
  • vendor/bin/phpcs src/SDK/SDK.php src/SDK/Extension/Appwrite.php tests/generation/GenerationTest.php — passed.
  • git diff --check — passed.
  • Regenerated with SDK_GEN_SPEC_FILE=$PWD/tests/resources/spec-openapi3.json php example.php <target> <platform> for PHP, Unity, Web, Node, Ruby, Python, Dart, Flutter, React Native, Go, Swift, Apple, .NET, Android, Kotlin, Rust, and CLI. Inspected the PHP example: Project/Key retained, optional Session omitted.
  • Go/CLI gofmt check passed on the initial generated trees.

Blocked / incomplete:

  • Clean Web/Node/React Native fixture regeneration fails Prettier checks in general.ts and several Node model files. Compared generated src/ files against an isolated unchanged-HEAD generation using the same fixture: no source differences. These failures predate this change. Chained lint/typecheck/test commands therefore did not run.
  • Clean CLI fixture build fails on missing go.sum entries and fixture-only SDK services; vet/test did not run. No dependency or generated-output patching was done to force a pass.
  • Remaining language formatter/static-analysis/e2e checks, Deno example.php regeneration (covered by Generation suite), genuine Cloud spec generation, canonical validation, and live-spec baseline comparison are not complete.

The passing PHP e2e uses fixture generation, not the new full Appwrite/Cloud document.

Subsequent genuine Cloud verification

Cloud #5716: non-publishing specs runs passed for 2.0.x and latest. Both artifacts are byte-identical, SHA256 5454c86362e1ee39d0eaa0d1f1282d965b334041824bc047336fe262a6c27740.

A controlled producer-parent run, using the same Cloud code, proves exactly 3 optional-extension removals and 16 security-array changes, with no other parsed differences. PHP SDK client/server/console complete trees match old generator 3418a5dbd + genuine baseline versus this PR 9e1423673 + genuine candidate, using isolated generator source autoloading and clean output directories.

The artifacts have 1,022 operations, 77 aliases, and 16 schemes. Differences from the published 1,020-operation spec include independent OAuth/DNS changes, also present in the controlled baseline. Strict OpenAPI validation still fails on an object schema with default: [], as does the published spec. Cross-language parity and deployed-generator compatibility remain pending. No screenshots apply to these nonvisual changes.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge, with no outstanding actionable findings.

Summary

  • Upgrades utopia-php/openapi to 0.2.2 and consumes accepted and required scheme names.
  • Handles path-bound and operation security schemes across all alternatives.
  • Omits optional credentials from examples while preserving independent x-appwrite.auth configuration.
  • Removes legacy optional checks from documentation templates and expands the shared fixture coverage.

Comment thread tests/generation/GenerationTest.php Resolved
@ChiragAgg5k
ChiragAgg5k merged commit 36833c5 into main Sep 9, 2026
59 checks passed
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.

1 participant