fix(remote): GitLab API data models to deserialize safely#1368
Open
ognis1205 wants to merge 2 commits intoorhun:mainfrom
Open
fix(remote): GitLab API data models to deserialize safely#1368ognis1205 wants to merge 2 commits intoorhun:mainfrom
ognis1205 wants to merge 2 commits intoorhun:mainfrom
Conversation
Signed-off-by: Shingo OKAWA <shingo.okawa.g.h.c@gmail.com>
Contributor
Author
|
One concern I have is that the way required/optional fields are modeled on the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1368 +/- ##
=======================================
Coverage 44.14% 44.14%
=======================================
Files 24 24
Lines 2286 2286
=======================================
Hits 1009 1009
Misses 1277 1277
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
|
Owner
|
Yeah, we could use |
orhun
approved these changes
Feb 6, 2026
Comment on lines
+1
to
+2
| TEST | ||
|
|
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.
Description
The current implementation of the GitLab Remote API data models diverges from the official OpenAPI specification in terms of optional/required fields:
https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/api/openapi/openapi.yaml
As a result, JSON ser/de errors occur in practice. This change fixes those mismatches to ensure reliable ser/de behavior.
Closes #1366 #687
Motivation and Context
The current implementation of the GitLab Remote API data models diverges from the official OpenAPI specification in terms of optional and required fields. This mismatch caused JSON ser/de errors, which could lead to panics when fetching data from the GitLab remote API.
This PR first fixes the optionality mismatches in the data models, and as a result resolves the panic that occurred during GitLab remote fetches.
Additionally, similar
JsonErrors should have also occurred in implementations prior to v2.10:b82221a#diff-9d830e0be5fc20135aee3ba39934c06263208881475d426a20c85a3b7dbba385L242-L251
However, due to the use of
take_while, these errors were unintentionally silenced, resulting in silent failures instead of visible errors. This fix therefore also addresses issues related to those previously hiddenJSON deserialization errors.
How Has This Been Tested?
cargo testNo additional tests were added, as this change only adjusts data model definitions and does not modify runtime logic.
Screenshots / Logs (if applicable)
N/A
Types of Changes
Checklist:
cargo +nightly fmt --allcargo clippy --tests --verbose -- -D warningscargo test