Skip to content

Improve error message for multiple implementations in HeteroDescribableConfigurator#2852

Merged
timja merged 2 commits into
jenkinsci:masterfrom
somiljain2006:improve-heterodescribable-error-message
Jun 14, 2026
Merged

Improve error message for multiple implementations in HeteroDescribableConfigurator#2852
timja merged 2 commits into
jenkinsci:masterfrom
somiljain2006:improve-heterodescribable-error-message

Conversation

@somiljain2006

@somiljain2006 somiljain2006 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #2589

JCasC actually already correctly rejects multiple implementations for a single-valued HeteroDescribable (like serverConfiguration in the OpenID Connect plugin) and fails the configuration. The underlying validation logic is already working as intended.

However, when this conflict occurs, JCasC throws a very generic IllegalArgumentException:

Single entry map expected to configure a <type>

While technically correct, the error does not identify which configuration entries caused the conflict, requiring users to inspect the configuration manually to determine the source of the problem.

This PR improves HeteroDescribableConfigurator.configureMapping to explicitly list the conflicting keys provided by the user, making configuration mistakes immediately clear.

Added a test covering a nested single-valued Describable configured with multiple implementations and verifying that the conflicting entries are reported in the exception message.

Your checklist for this pull request

🚨 Please review the guidelines for contributing to this repository.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test case? That demonstrates a feature works or fixes the issue.

@somiljain2006 somiljain2006 requested a review from a team as a code owner June 13, 2026 05:18
@timja timja added the feature A PR that adds a feature - used by Release Drafter label Jun 14, 2026
@timja timja merged commit e3b42c6 into jenkinsci:master Jun 14, 2026
17 checks passed
@somiljain2006 somiljain2006 deleted the improve-heterodescribable-error-message branch June 14, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A PR that adds a feature - used by Release Drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CasC allows duplicate entries for single valued Describables without warning.

2 participants