fix(crowdin): improve Screenshot and Distribution model parity#1142
Conversation
- Add ProjectID to Screenshot model - Add BranchIDs and DirectoryIDs to Distribution and DistributionAddRequest models - Update contract tests for screenshots, labels, and distributions to verify the new fields - Document learnings in .jules/crowdin-steward.md Co-authored-by: cungminh2710 <8063319+cungminh2710@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Greptile SummaryThis PR adds missing Crowdin API v2 fields to two Go SDK models:
Confidence Score: 5/5Safe to merge — all changes are additive field additions to existing structs with no logic changes. The diff is limited to adding new JSON-tagged fields to two response models and one request model. Response model fields carry no omitempty (consistent with existing peers), request model fields carry omitempty (correct for optional inputs). The previous thread's concern about asymmetric omitempty on Distribution has been resolved. Contract tests cover all four Distribution service operations and all affected Screenshot tests, and the serialization order in DistributionAddRequest matches the test body expectation. No files require special attention.
|
| Filename | Overview |
|---|---|
| third_party/crowdin-api-client-go/crowdin/model/distributions.go | Added BranchIDs and DirectoryIDs to Distribution (response, no omitempty) and DistributionAddRequest (request, with omitempty); field order updated to group the new slice fields before CreatedAt/UpdatedAt; consistent with existing patterns. |
| third_party/crowdin-api-client-go/crowdin/model/screenshot.go | Added ProjectID int field with json:"projectId" to Screenshot response struct; straightforward additive change with no omitempty needed for a response model. |
| third_party/crowdin-api-client-go/crowdin/distributions_test.go | All four test cases (List, Get, Add, Edit) updated with branchIds/directoryIds in both JSON fixtures and expected structs; Add test also verifies correct request body serialization including the new fields. |
| third_party/crowdin-api-client-go/crowdin/screenshots_test.go | GetScreenshot test updated with projectId: 2 in both fixture and expected struct; minimal, correct change. |
| third_party/crowdin-api-client-go/crowdin/labels_test.go | AssignToScreenshots and UnassignFromScreenshots tests updated with projectId: 1 in both JSON fixtures and expected Screenshot structs. |
| .jules/crowdin-steward.md | Stewardship log entry added documenting the new fields and updated tests; informational only. |
Class Diagram
%%{init: {'theme': 'neutral'}}%%
classDiagram
class Screenshot {
+int ID
+int ProjectID
+int UserID
+string URL
+string WebURL
+string Name
+struct Size
+int TagsCount
+[]Tag Tags
+[]int LabelIDs
+string CreatedAt
+string UpdatedAt
}
class Distribution {
+string Hash
+string Name
+[]int BundleIDs
+[]int BranchIDs
+[]int DirectoryIDs
+[]int FileIDs
+string CreatedAt
+string UpdatedAt
+string ExportMode
+string ManifestURL
}
class DistributionAddRequest {
+string Name
+ExportMode ExportMode
+[]int FileIDs
+[]int BundleIDs
+[]int BranchIDs
+[]int DirectoryIDs
+Validate() error
}
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
classDiagram
class Screenshot {
+int ID
+int ProjectID
+int UserID
+string URL
+string WebURL
+string Name
+struct Size
+int TagsCount
+[]Tag Tags
+[]int LabelIDs
+string CreatedAt
+string UpdatedAt
}
class Distribution {
+string Hash
+string Name
+[]int BundleIDs
+[]int BranchIDs
+[]int DirectoryIDs
+[]int FileIDs
+string CreatedAt
+string UpdatedAt
+string ExportMode
+string ManifestURL
}
class DistributionAddRequest {
+string Name
+ExportMode ExportMode
+[]int FileIDs
+[]int BundleIDs
+[]int BranchIDs
+[]int DirectoryIDs
+Validate() error
}
Reviews (2): Last reviewed commit: "fix(crowdin): improve Screenshot and Dis..." | Re-trigger Greptile
- Add ProjectID to Screenshot model - Add BranchIDs and DirectoryIDs to Distribution and DistributionAddRequest models - Fix field order and visibility for Distribution fields to match API v2 parity - Update contract tests for screenshots, labels, and distributions - Document learnings in .jules/crowdin-steward.md Co-authored-by: cungminh2710 <8063319+cungminh2710@users.noreply.github.com>
This PR improves the parity of the Crowdin Go client models with the official API v2 for Screenshots and Distributions.
What:
projectId(int) to theScreenshotmodel.branchIds([]int) anddirectoryIds([]int) to bothDistributionandDistributionAddRequestmodels.screenshots_test.go,labels_test.go, anddistributions_test.go.Why:
These fields are part of the Crowdin API v2 contract but were missing from the Go SDK, preventing users from accessing or specifying these granular identifiers.
Docs:
Tests:
GOWORK=off go test ./crowdin/...within thethird_party/crowdin-api-client-godirectory.go test ./...in the repository root.Confidence:
The changes are additive to response models and use
omitemptyfor request models, ensuring backward compatibility while enabling access to documented API fields. Verified with updated contract tests.PR created automatically by Jules for task 3784772611125568900 started by @cungminh2710