Skip to content

[4.x] Send only the given values when creating or editing repositories and users - #91

Open
Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-edit-only-given-fields
Open

Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-edit-only-given-fields

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Repositories::edit($owner, $repo, $name) always sent description='', homepage='', private=false, has_issues=false, has_wiki=false, has_downloads=false and default_branch=''. A plain rename therefore wiped the description, disabled issues and the wiki, and turned a private repository public. Users::edit() likewise sent '' for every profile field that was not passed, clearing name, blog, company, bio and so on. Repositories::create() sent team_id: 0 and empty values instead of leaving GitHub's defaults in place.

The optional parameters of these three methods now default to null, and only non-null values are sent — the pattern Issues::edit() and Pulls::edit() already use. Values passed explicitly (including '' and false) are still sent, so callers that deliberately clear a field keep working.

This is technically a behaviour change in 4.x, but no caller can reasonably rely on the data loss.

Testing Instructions

RepositoriesTest::testCreate, testCreateWithOrg and testEdit now expect only the given values; RepositoriesTest::testEditSendsOnlyGivenValues and UsersTest::testEditSendsOnlyGivenValues cover partial edits with named arguments. All five fail before the change.

Documentation Changes Required

docs/overview.md: new section "Creating and editing repositories and the user profile".

🤖 Generated with Claude Code

…users

Repositories::edit() sent every parameter that was not given with its
default, so renaming a repository cleared its description, disabled
issues and the wiki and made a private repository public. Users::edit()
cleared every profile field that was not passed, and Repositories::create()
sent team_id 0 and empty values instead of letting GitHub apply its
defaults.

Default the optional parameters to null and send only the values that
are given, as Issues::edit() and Pulls::edit() already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant