Repository navigation
fix(templates): enum constants, null serialization, and object conversion - #1681
Merged
Merged
Conversation
…t conversion - ruby: model enum validation referenced constants via caseUpper, producing invalid Ruby for hyphenated enum values (FAILING-OVER parses as subtraction). Use the same keys-aware caseEnumKey the enum module uses. - dart/flutter: optional nullable parameters were serialized as explicit JSON null instead of being omitted; Dart cannot distinguish omitted from null, so guard every non-required parameter. - dotnet: object-typed model properties fell into the string fallback and were converted with ToString(), corrupting structured data such as AppInstallation.authorizationDetails. Pass the raw value through.
Contributor
Greptile SummaryFixes generated SDK behavior across three languages:
Confidence Score: 5/5The PR appears safe to merge, with no concrete changed-code failures identified. The updated templates consistently preserve optional-parameter omission semantics, raw .NET object values, and Ruby enum constant naming while leaving required-nullable and non-object paths intact. Important Files Changed
Reviews (1): Last reviewed commit: "fix(templates): correct enum constants, ..." | Re-trigger Greptile |
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.
Fixes three template bugs surfaced by Greptile reviews on the 1.9.x SDK release PRs (appwrite/sdk-for-ruby#68, appwrite/sdk-for-dart#122, appwrite/sdk-for-dotnet#100).
Ruby: invalid enum constant references in model validation
model.rb.twig/request_model.rb.twigbuilt enum constant references withvalue | caseUpper, while the enum module itself is generated withcaseEnumKey. For hyphenated enum values this produced invalid Ruby —DatabaseStatus::FAILING-OVERparses as subtraction between two undefined constants, so anyDatabaseresponse with a non-null status raisedNameError. Both templates now use the same keys-awarecaseEnumKeyconversion as the enum module.Dart/Flutter: optional nullable params serialized as explicit JSON null
The
map_parametermacro only null-guarded optionals whennot parameter.nullable. Dart has noundefined, so omitted nullable optionals were sent as explicit"key": null— e.g.oauth2.authorizePostsentmax_age: null, andorganization.updateInstallationsentauthorizationDetails: null(which the server can interpret as clearing the field). Every non-required parameter is now guarded withif (x != null); required nullable parameters are still always sent..NET: object-typed model properties corrupted by ToString()
Model.cs.twig'sFrom()had no branch for plainobject-typed properties, so they fell into the string fallback and were converted with.ToString()—AppInstallation.authorizationDetailscame back as a type-name string instead of the structured data. Added an object branch that passes the raw map value through unchanged.Validation
Regenerated the server Ruby, Dart, and .NET SDKs plus the client Flutter SDK against the Appwrite Cloud 1.9.x spec with these templates:
DatabaseStatus::FAILING_OVERgenerated correctly;ruby -cpasses on all generated modelsif (maxAge != null),if (authorizationDetails != null),if (replicas != null),if (targetReplicaId != null)guards now emitted in all previously affected methodsauthorizationDetails: map["authorizationDetails"]passed through raw; all other property kinds unchanged