feat: add missing PUT /projects/:id attributes to ProjectApi.updateProject (#1324)#1325
Open
bigpuritz wants to merge 1 commit into
Open
feat: add missing PUT /projects/:id attributes to ProjectApi.updateProject (#1324)#1325bigpuritz wants to merge 1 commit into
bigpuritz wants to merge 1 commit into
Conversation
ProjectApi.updateProject() was missing 35 attributes supported by the GitLab REST API for PUT /projects/:id, so those settings could not be changed through GitLab4J-API. - Add 20 new fields (+ getters/setters/builders) to the Project model that had no representation yet (e.g. merge_trains_enabled, package_registry_access_level, mr_default_title_template, ...). - Wire all 35 attributes into ProjectApi.updateProject(); the remaining 15 already had model getters but were never sent. - Extend the project.json test fixture with the 20 new attributes so TestGitLabApiBeans.testProject round-trips them. Deprecated/superseded attributes (emails_disabled, restrict_user_defined_variables) and the multipart-only `avatar` attribute are intentionally not included. Refs gitlab4j#1324
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
ProjectApi.updateProject(Project)was missing 35 attributes that the GitLab REST API supports forPUT /projects/:id. As a result, those settings could not be changed through GitLab4J-API even though the GitLab server accepts them.Reference: GitLab API – Edit/Update a project.
Closes #1324
Changes
Projectmodel: added 20 new fields (with getters/setters/withXxxbuilders) that had no representation yet — e.g.merge_trains_enabled,merge_trains_skip_train_allowed,max_pipelines_per_merge_train,package_registry_access_level,mr_default_title_template,mr_default_target_self,mirror_user_id,mirror_overwrites_diverged_branches,only_mirror_protected_branches,prevent_merge_without_jira_issue,protect_merge_request_pipelines,spp_repository_pipeline_access,web_based_commit_signing_enabled,web-/duo-/ci-related flags,max_artifacts_size,merge_pipelines_enabled,auto_duo_code_review_enabled.ProjectApi.updateProject(): wired all 35 attributes into the request. The other 15 already had model getters but were never sent (e.g.auto_devops_enabled,ci_default_git_depth,import_url,service_desk_enabled,keep_latest_artifact,allow_merge_on_skipped_pipeline, …).ci_id_token_sub_claim_componentsis sent via theList<?>overload.project.jsonwith the 20 new attributes soTestGitLabApiBeans.testProjectround-trips (serialize/deserialize) every new field.Intentionally excluded
emails_disabled,restrict_user_defined_variables— deprecated and already superseded by attributes that are present (emails_enabled,ci_pipeline_variables_minimum_override_role).avatar— already covered by the dedicated multipart methodsetProjectAvatar(...); not applicable to the form-dataupdateProject.Test plan
./gradlew build— BUILD SUCCESSFUL (Spotless/Palantir formatting check, compilation of both modules, all tests)TestGitLabApiBeans.testProject— strict JSON round-trip passes with all 20 new fieldsTestProjectApi) — not run here (requires a configured GitLab instance)Notes (out of scope, not changed here)
updateProjectstill sendsbuild_coverage_regex, which no longer exists in the currentPUT /projects/:idspecification;template_name,use_custom_template,group_with_project_templates_id, andrepository_object_formatare create-only parameters with no effect on update. These can be addressed separately if desired.