Skip to content

null or empty description no longer duplicates allowed fields - #50861

Open
edewit wants to merge 2 commits into
keycloak:mainfrom
edewit:issue-50860
Open

null or empty description no longer duplicates allowed fields#50861
edewit wants to merge 2 commits into
keycloak:mainfrom
edewit:issue-50860

Conversation

@edewit

@edewit edewit commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

fixes: #50860
Signed-off-by: Erik Jan de Wit erikjan.dewit@gmail.com

Copilot AI review requested due to automatic review settings July 14, 2026 10:26
@edewit
edewit requested review from a team as code owners July 14, 2026 10:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes duplicate “Allowed fields” text when the OpenAPI filter runs repeatedly.

Changes:

  • Extracts a reusable allowed-fields prefix.
  • Handles generated descriptions without preceding text.
  • Documents idempotent suffix removal.

Copilot AI review requested due to automatic review settings July 15, 2026 08:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

fixes: keycloak#50860
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Copilot AI review requested due to automatic review settings July 15, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Copilot AI review requested due to automatic review settings July 28, 2026 11:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

rest/admin-v2/services/src/test/java/org/keycloak/admin/internal/openapi/OpenApiSortParameterTest.java:159

  • These tests rely on reflective access to a private method (OASModelFilter.enhanceSortParameterDescription) and a specific field name (ListOptions.sort), which makes them brittle to innocuous refactors (renames/visibility changes) and can be problematic under stricter reflective access. Prefer testing via public behavior (e.g., asserting on the generated OpenAPI output for a representative endpoint), or make the helper logic package-private and explicitly testable (e.g., @VisibleForTesting) to avoid setAccessible(true).
    private static String enhanceSortParameterDescription(String description) throws Exception {
        Method method = OASModelFilter.class.getDeclaredMethod("enhanceSortParameterDescription", String.class, String.class);
        method.setAccessible(true);
        return (String) method.invoke(null, description, ClientField.allowedApiNames());
    }

    private static String listOptionsSortDescription() throws Exception {
        Field sortField = ListOptions.class.getDeclaredField("sort");
        Parameter parameter = sortField.getAnnotation(Parameter.class);
        assertNotNull(parameter, "sort query parameter in ListOptions must declare @Parameter");
        return parameter.description();
    }

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty or null description causes duplicate "Allowed field:"

2 participants