Skip to content

Fix organization creation when domain is empty#50857

Open
ayushmanayush wants to merge 4 commits into
keycloak:mainfrom
ayushmanayush:fix-50825
Open

Fix organization creation when domain is empty#50857
ayushmanayush wants to merge 4 commits into
keycloak:mainfrom
ayushmanayush:fix-50825

Conversation

@ayushmanayush

Copy link
Copy Markdown

Description

Fixes the regression introduced in 26.7.0 where creating an organization
without specifying a domain results in an "Invalid domain format" error.

Root cause

The frontend converted empty domain values into domain objects, causing
validation to fail even though the domain field is optional.

Solution

Filter out empty domain values before creating the domain objects so that
validation is only applied to non-empty domains.
Fixes #50825

Copilot AI review requested due to automatic review settings July 14, 2026 08:59
@ayushmanayush
ayushmanayush requested review from a team as code owners July 14, 2026 08:59
Signed-off-by: ayush <ishusingh1404@gmail.com>

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 organization creation when the optional domain field is empty.

Changes:

  • Filters blank domains before API conversion.
  • Allows blank input in shared domain validation.

Reviewed changes

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

File Description
Organizations.java Treats blank domains as absent.
OrganizationForm.tsx Excludes blank domains from requests.


public static void validateDomain(String rawDomain) {
if (rawDomain == null) {
if (rawDomain == null || isBlank(rawDomain)) {
Copilot AI review requested due to automatic review settings July 14, 2026 09:10

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.

Comment on lines +24 to +26
domains: org.domains
?.filter((d) => d.trim() !== "")
.map((d) => ({ name: d, verified: false })),

public static void validateDomain(String rawDomain) {
if (rawDomain == null) {
if (rawDomain == null || isBlank(rawDomain)) {
Copilot AI review requested due to automatic review settings July 15, 2026 10:15

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.


public static void validateDomain(String rawDomain) {
if (rawDomain == null) {
if (rawDomain == null || isBlank(rawDomain)) {
Comment on lines +24 to +26
domains: org.domains
?.filter((d) => d.trim() !== "")
.map((d) => ({ name: d, verified: false })),
@sguilhen
sguilhen requested review from edewit and ssilvert July 17, 2026 02:48
@sguilhen

Copy link
Copy Markdown
Contributor

@ssilvert @edewit could you please review this one? It is a fix for a regression in 26.7

@ssilvert

Copy link
Copy Markdown
Contributor

@ayushmanayush All the suggestions from Copilot appear to be valid. Please fix them before we proceed with further review.

@ayushmanayush

ayushmanayush commented Jul 17, 2026

Copy link
Copy Markdown
Author

Ok I'll further look into it and update asap

Copilot AI review requested due to automatic review settings July 17, 2026 18:41

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.

Comment on lines +24 to +26
domains: org.domains
?.filter((d) => d.trim() !== "")
.map((d) => ({ name: d, verified: false })),
Copilot AI review requested due to automatic review settings July 17, 2026 18: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 3 out of 3 changed files in this pull request and generated 1 comment.


public static void validateDomain(String rawDomain) {
if (rawDomain == null) {
if (isBlank(rawDomain)) {
@ssilvert

Copy link
Copy Markdown
Contributor

@ayushmanayush We need you to sign your commits so that DCO will pass.

Signed-off-by: ayush <ishusingh1404@gmail.com>
@sguilhen

Copy link
Copy Markdown
Contributor

I think all commits need to be signed-off for the DCO check to pass. So either add the sign-off or, better yet, squash them into one

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.

Creating an organization without a domain leads to an error

4 participants