Skip to content

Conversation

@XingY
Copy link
Contributor

@XingY XingY commented Dec 10, 2024

Rationale

This set of PRs implement a set of rules what characters / patterns can be used as domain (sample, data class, list, etc) names for new domains as well as existing domains when they are re-named.

Related Pull Requests

Changes

  • Add DomainUtil.validateDomainName and wire up domain name validation during creation and update
  • Validate parentAlias to avoid conflict with naming pattern syntax
  • Support parent and ancestor naming pattern for parent type that contains /, in the form of $S
  • fix detailed audit with special names
  • Add jest integration test for validating domain names
  • Update / Add selenium tests for domain names with special characters

inputs.get(INPUT_PARENT).addAll(parents);
inputs.computeIfAbsent(INPUT_PARENT + "/" + parts[1], (s) -> new LinkedHashSet<>()).addAll(parents); // add Inputs/SampleType1
inputs.get(inputsCategory).addAll(parents);
// TODO, parents broken
Copy link
Contributor

Choose a reason for hiding this comment

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

Still TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

}

@Override
public boolean supportNamingPattern()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public boolean supportNamingPattern()
public boolean supportsNamingPattern()

String prefix = "Invalid " + kindName + " name. ";

if (StringUtils.isBlank(domainName))
return "Domain name must not be blank";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return "Domain name must not be blank";
return "Domain name must not be blank.";


char start = domainName.charAt(0);
if (!Character.isLetterOrDigit(start))
return prefix + "Domain name must start with a letter or a number character.";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return prefix + "Domain name must start with a letter or a number character.";
return prefix + "Domain name must start with a letter or a number.";

(or it could be "must not start with a letter or a digit")

if (!Character.isLetterOrDigit(start))
return prefix + "Domain name must start with a letter or a number character.";

//final String legalChars = " -_()&/.:";
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove?

return validationException;
}

public static @Nullable String validateDomainName(@NotNull String domainName, String kindName, boolean supportNamingPattern)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static @Nullable String validateDomainName(@NotNull String domainName, String kindName, boolean supportNamingPattern)
public static @Nullable String validateDomainName(@NotNull String domainName, String kindName, boolean supportsNamingPattern)


public static @Nullable String validateDomainName(@NotNull String domainName, String kindName, boolean supportNamingPattern)
{
String prefix = "Invalid " + kindName + " name. ";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
String prefix = "Invalid " + kindName + " name. ";
String prefix = "Invalid " + kindName + " name '" + domainName + "'.";


@LogMethod
protected void renameDataset(String orgName, String newName, String orgLabel, String newLabel, String... fieldNames)
protected void renameDataset(String error, String orgName, String newName, String orgLabel, String newLabel, String... fieldNames)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected void renameDataset(String error, String orgName, String newName, String orgLabel, String newLabel, String... fieldNames)
protected void renameDataset(@Nullable String error, String orgName, String newName, String orgLabel, String newLabel, String... fieldNames)

@XingY XingY requested a review from labkey-susanh December 13, 2024 00:46
@XingY XingY merged commit 5bda2b7 into develop Dec 16, 2024
2 of 9 checks passed
@XingY XingY deleted the fb_domainNameValidation branch December 16, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants