Repository navigation
fix: serialize response models to match the published spec - #14158
Merged
Merged
Conversation
Strict SDK clients generated from the OpenAPI spec reject proxy rules with an empty deploymentResourceType, execution headers with non-string values, and empty JSON objects that encode as [] (presence metadata, migration statusCounters/options, schedule data).
🟢 Tier S · Ready to merge
Normalizes response serialization to match the published model contracts: nullable deployment resource types, string-valued execution headers, and empty JSON objects for presence metadata, migration counters/options, and schedule data. Adds regression tests for normalization, defaults, and preservation of populated values.
📂 Walkthrough · 10
Reviewed |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
TorstenDittmann
approved these changes
Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Appwrite MCP server uses the generated Console Python SDK, whose strict pydantic models are built from the OpenAPI spec. Sentry shows several responses that don't match the spec, so the SDK rejects them. This PR updates the response models so their output matches what the spec declares.
deploymentResourceTypefails enum validationapi/redirectrules storedeploymentResourceType = '', but the spec declares a nullable enum (function,site)Rule::filter()emitsnullinstead of''. The rule is alreadyrequired => false, so the spec marks it nullablevalueis not a stringExecution::filter()only joined list values, so scalars such ascontent-length: 8807passed through as int,, scalars are stringified, strings are keptmetadatais[]Presence::filter()outputsstdClassfor empty metadata, so it encodes as{}options/statusCountersare[][], and the filter had no empty-object handling (it also returns early when there are no errors)stdClass, andMigration::filter()converts empty arrays tostdClassbefore the early returndatais[]datahit the[]default, and stored{}decodes to[]stdClass, andSchedule::filter()converts empty arraysI left other rule fields such as
deploymentIdanddeploymentResourceIdalone. They are required strings, so''is valid. MigrationresourceDatais a JSON array in the spec, so[]is correct there.Response.phpis unchanged.Verification
vendor/bin/phpunit tests/unit/Utopia tests/unit/SDK: OK (361 tests)ExecutionTest::testHeaderValuesAreStringsfails without thesrc/change and passes with it.composer lint: passedcomposer analyze: no errorscomposer refactor:check: OKRelated: appwrite-labs/cloud#5938