Skip to content

Conversation

froozeify
Copy link
Member

Checklist before requesting a review

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.

Description

When creating a webhook for the ITILFollowup we got some exception about missing array key value (parent) or an array key allocation with the key being an array and not a string making the suggestion not working

Screenshots:

image

@froozeify froozeify changed the title Fix arrays exception (key not existing or value was an array) Webhook: Fix arrays exception (key not existing or value was an array) Sep 29, 2025
@cedric-anne cedric-anne added this to the 11.0.0 milestone Sep 29, 2025
@froozeify froozeify changed the title Webhook: Fix arrays exception (key not existing or value was an array) Webhook: Can't edit the webhook configuration for ITILFollowup Sep 29, 2025
@froozeify froozeify changed the title Webhook: Can't edit the webhook configuration for ITILFollowup Webhook: Can't edit the webhook configuration for ITILFollowup - multiple array exceptions Sep 29, 2025
Copy link
Member

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

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

It seems to conflict with some changes proposed in #21136.

@froozeify
Copy link
Member Author

I've updated to pick part of what @SebSept did in his PR

public function testGetMonacoSuggestions()
{
$itemtypes = \Webhook::getItemtypesDropdownValues();
$noSuggestions = ['Document_Item'];
Copy link
Member

Choose a reason for hiding this comment

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

@cconard96 Could you validate that having no suggestions for Document_Item is expected?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, it isn't. No itemtype option for webhooks should be missing suggestions because if they are, it means the feature is broken for that itemtype and doesn't know how to get the data from the API.

Copy link
Contributor

@cconard96 cconard96 Sep 29, 2025

Choose a reason for hiding this comment

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

This itemtype is likely broken because it is provided by ManagementController, not ITILController.

Copy link
Member Author

@froozeify froozeify Sep 30, 2025

Choose a reason for hiding this comment

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

Looks like it is the ITILController that is called, but indeed inside it I don't see the Document

Image

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you know where the schema is declared so I can see why document is not returned in ITILController

Copy link
Member Author

Choose a reason for hiding this comment

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

It should be in ITILController::225 but I don't see any reference to the Document type, maybe this schema is missing.

Copy link
Contributor

Choose a reason for hiding this comment

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

In getAPIItemtypeData the Document_Item::class entry needs moved under the ManagementController array so it knows where to find the schema.

Currently, the possible parents for "subtypes" only account for the classes listed under the "main" array for each controller. This should be changed to look in all of the "main" arrays. For any cases where an empty array is used, we could continue using all "main" itemtypes in its own controller or switch them to a static list. I would prefer a static list at this point for more stability.

@trasher trasher merged commit 62c7b98 into glpi-project:11.0/bugfixes Sep 30, 2025
10 checks passed
@froozeify froozeify deleted the 11.0/webhook-multiple-array-exceptions-for-itilfollowup branch October 1, 2025 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants