Skip to content

Add validation to the name field in configuration.#829

Merged
JacobMGEvans merged 1 commit intomainfrom
worker-name-validation
Apr 26, 2022
Merged

Add validation to the name field in configuration.#829
JacobMGEvans merged 1 commit intomainfrom
worker-name-validation

Conversation

@JacobMGEvans
Copy link
Contributor

The validation will warn users that the field can only be "type string,
alphanumeric and lowercase with dashes only" using the same RegEx as the backend

resolves #795 #775

@JacobMGEvans JacobMGEvans added the enhancement New feature or request label Apr 20, 2022
@changeset-bot
Copy link

changeset-bot bot commented Apr 20, 2022

🦋 Changeset detected

Latest commit: 7f82664

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Apr 20, 2022

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2229453510/npm-package-wrangler-829

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/829/npm-package-wrangler-829

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/2229453510/npm-package-wrangler-829 dev path/to/script.js

@JacobMGEvans
Copy link
Contributor Author

Something to consider, environment names will be attached to worker names, in those cases we need to either validate the environment name in the same way or modify it programmatically.

@JacobMGEvans JacobMGEvans linked an issue Apr 20, 2022 that may be closed by this pull request
Copy link
Contributor

@threepointone threepointone left a comment

Choose a reason for hiding this comment

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

Could you add a couple of tests for invalid worker names? With special characters, etc.


it("should error on invalid `name` value with special characters", () => {
const expectedConfig: RawEnvironment = {
name: "Thy'lek-Shran",
Copy link
Contributor

Choose a reason for hiding this comment

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

One for Igor :-D

@JacobMGEvans JacobMGEvans force-pushed the worker-name-validation branch 2 times, most recently from e813633 to 088b2c1 Compare April 26, 2022 21:23
The validation will warn users that the field can only be "type string,
alphanumeric and lowercase with dashes only" using the same RegEx as the backend

resolves #795 #775
@JacobMGEvans JacobMGEvans force-pushed the worker-name-validation branch from 088b2c1 to 7f82664 Compare April 26, 2022 21:24
@JacobMGEvans JacobMGEvans merged commit f08aac5 into main Apr 26, 2022
@JacobMGEvans JacobMGEvans deleted the worker-name-validation branch April 26, 2022 21:32
@github-actions github-actions bot mentioned this pull request Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 BUG: wrangler throws a ParseError when script name contains uppercase characters in wrangler.toml bug: invalid worker names shouldn't be allowed

4 participants

Comments