Skip to content

Fix WebhookClient.CreateAsync array response handling#45

Merged
barnon-apiiro merged 3 commits into
masterfrom
barnon/fix-webhook-create-array-response
Mar 10, 2026
Merged

Fix WebhookClient.CreateAsync array response handling#45
barnon-apiiro merged 3 commits into
masterfrom
barnon/fix-webhook-create-array-response

Conversation

@barnon-apiiro

@barnon-apiiro barnon-apiiro commented Mar 9, 2026

Copy link
Copy Markdown

Summary

  • GitLab API now returns a JSON array from POST /projects/:id/hooks instead of a single object
  • This causes JsonSerializationException in WebhookClient.CreateAsync which expects a single Webhook
  • Fix deserializes as JToken first, then handles both array and single object responses
  • Bumps version to 0.1.45

Note: CI fixes are in a separate PR: #46

Test plan

  • Deploy to CI staging and verify webhook creation no longer throws exceptions
  • Verify existing webhook operations (get, delete, update) still work

🤖 Generated with Claude Code

@barnon-apiiro
barnon-apiiro force-pushed the barnon/fix-webhook-create-array-response branch from 8df86d3 to 82a9c73 Compare March 9, 2026 14:19
barnon-apiiro and others added 3 commits March 10, 2026 10:25
GitLab API now returns a JSON array from POST /projects/:id/hooks instead
of a single object, causing JsonSerializationException. Deserialize as
JToken and handle both array and object responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@barnon-apiiro
barnon-apiiro force-pushed the barnon/fix-webhook-create-array-response branch from 82a9c73 to fee9c90 Compare March 10, 2026 09:25
@barnon-apiiro
barnon-apiiro requested a review from a team March 10, 2026 09:30
/// <returns>newly created hook</returns>
public async Task<Webhook> CreateAsync(ProjectId projectId, CreateWebhookRequest request) =>
await _httpFacade.Post<Webhook>($"projects/{projectId}/hooks", request);
public async Task<Webhook> CreateAsync(ProjectId projectId, CreateWebhookRequest request)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why doesnt it force you to use Task<Webhook?>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Becuase I relaxed the rules in this repo.

@barnon-apiiro
barnon-apiiro merged commit f8fd832 into master Mar 10, 2026
2 checks passed
@barnon-apiiro
barnon-apiiro deleted the barnon/fix-webhook-create-array-response branch March 10, 2026 10:51
barnon-apiiro added a commit that referenced this pull request Mar 11, 2026
…array-response"

This reverts commit f8fd832, reversing
changes made to c6d30e7.
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.

2 participants