fix: validate string array parameters from SDK schemas - #10
Open
HarshMN2345 wants to merge 3 commits into
Open
Conversation
|
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.
The Console Python SDK advertises arrays of strings but currently accepts query objects and other incompatible values until request serialization fails. This causes the local concatenation crash reported in MCP-X.
Apply the schema-driven Python template change from sdk-generator#1899. Every request parameter whose schema declares an array of strings now rejects incompatible inputs before HTTP with an
AppwriteExceptionof typesdk_input_validation(code 0, no HTTP response). This covers permissions, scopes, events, and other parameter names as well as queries. Optional values, empty arrays, string-backed enum members, and nullable items retain their declared behavior. JSON syntax validation remains with the API because the schema only declares string items.The generic serializer correction also remains: list indices are chosen before string-key concatenation, preserving support for nested raw and multipart parameters.
Generation provenance: rendered the before/after templates against the immutable Console OpenAPI snapshot at specs@19db43b, then applied only the generated validation delta: 282 calls across 36 service files and the existing base Service validator. Every affected parameter's annotation and default matches SDK 0.6.0; stripping the new calls leaves the original service ASTs unchanged. No unrelated API, response-model, or release-metadata changes are included.
Validation: all 1,058 SDK tests and Black checks for all 39 changed Python files pass. Existing TablesDB service tests cover six invalid query shapes and three invalid permission shapes, each returning the typed local error without sending HTTP. Removing the generated checks reproduces all nine failures. Unicode JSON queries, empty/omitted options, and enum/string index orders remain successful. Tests use local HTTP mocks. Downstream MCP handling and regressions are tracked in mcp#117; the SDK must be released and adopted before the production incident is resolved.