Skip to content

[backport into 4.x] correct property values from enums are sometimes flagged as error #1606

Closed

Description

@martinlippert

Backport issue for #1605 for the 4.32.0 release:

management.endpoint.health.show-details=when_authorized

is flagged as an error, even though the Spring Boot internally converts when_authorized correctly to Show.WHEN_AUTHORIZED.

It looks like the validation logic around enum values for properties is currently:

  • lower-case name of the enum with - instead of _ (when-authorized does not show an error)
  • upper-case exact name of the enum (WHEN_AUTHORIZED does not show an error)

But the conversion logic in Spring Boot is a little different. It is located in LenientObjectToEnumConverterFactory. It basically is:

  • does the value match the exact enum value (in this case WHEN_AUTHORIZED)
  • if not, then strip all non-digit and non-letter characters, convert to lowercase, and find the enum value that way.

That results in:

  • when_authorized is mapped to WHEN_AUTHORIZED
  • when-authorized is mapped to WHEN_AUTHORIZED
  • WHEN-AUTHORIZED is mapped to WHEN_AUTHORIZED

This should be reflected in the validation logic for the property editors (.properties + .yml).

Activity

  1. added this to the 4.32.0.RELEASE milestone on Jul 21, 2025
  2. added
    for: eclipse
    for: vscode
    on Jul 21, 2025
  3. changed the title [-]correct property values from enums are sometimes flagged as error[/-] [+][backport into 4.x] correct property values from enums are sometimes flagged as error[/+] on Jul 21, 2025
  4. BoykoAlex commented on Jul 24, 2025

    @BoykoAlex
    Contributor

    Fixed in 4.x via e7e6823

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetheme: property-editing-supporttype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions