Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a topic fails with unclear error message if topic name does not match rules #1033

Open
1 task done
mschroedercflt opened this issue Feb 7, 2025 · 2 comments
Open
1 task done
Assignees

Comments

@mschroedercflt
Copy link
Member

Code of Conduct

  • I agree to follow this project's Code of Conduct

On what operating system are you seeing the problem?

No response

VS Code version

When creating a new topic, for example with a space in the name, the error message is not very clear. It reads: "Payload Error. Invalid topic name." but the rules for topic names are not evident anywhere.

Image

Version of Confluent extension

No response

To Reproduce

  1. Click "Create Topic"
  2. Give invalid name
  3. Accept defaults

Current vs. Expected behavior

I expected either:
A) the help text to provide the rules for what topic names look like
B) the error message to clarify the rules or specify the invalid character

Relevant log output

Which area(s) are affected? (Select all that apply)

Topics

Additional context

No response

@shouples
Copy link
Contributor

shouples commented Feb 7, 2025

We should use validateInput here like we do in the local Docker broker input box.

const numContainersString: string | undefined = await window.showInputBox({
title: "Start Confluent Local",
prompt: "Enter the number of Kafka brokers to start (1-4)",
placeHolder: "1",
value: "1",
ignoreFocusOut: true,
validateInput: validateBrokerInput,
});

/** Validate the user's input for the number of brokers/containers to start. */
export function validateBrokerInput(userInput: string): InputBoxValidationMessage | undefined {
const num: number = parseInt(userInput, 10);
if (isNaN(num) || num < 1 || num > 4) {
return {
message: "Please enter a number between 1 and 4 (inclusive)",
severity: InputBoxValidationSeverity.Error,
};
}
return;
}

@jlrobins jlrobins self-assigned this Feb 7, 2025
@jlrobins
Copy link
Contributor

jlrobins commented Feb 7, 2025

@mschroedercflt asserts that the authoritative regex is [a-zA-Z0-9\._-] max 249 characters as from the source code

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

No branches or pull requests

3 participants