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

refactor: fix ProjectName validation, custom Path extractor for parsing it #1354

Merged
merged 17 commits into from Nov 3, 2023

Conversation

jonaro00
Copy link
Member

@jonaro00 jonaro00 commented Oct 28, 2023

Description of change

Custom axum extractor that prints the parse error message for the custom deser.

Supersedes of #1236, Check only the last commits.

  • TODO?: Move axum module somewhere else?
  • Q: Deployer's endpoints can skip using it due to ProjectNameGuard. Should they?

How has this been tested? (if applicable)

On normal API calls
image
On interaction in init (should this be red?)
image

  • added tests

thass0 and others added 8 commits October 19, 2023 22:53
- Merge both implementations of `ProjectName`.
- Improve project name validation with changes from PR #418.

Fixes #1223
When the entire workspace is compiled together,
like in CI clippy check, logger enables the sqlx/postgres
feature. When ProjectName in common is compiled, it is usually
done with only the sqlx/sqlite feature. Enabling postgres from
logger makes the sqlx derive macro break for some reason.
This fixes it.
Might save some time by performing the constant
time and light-weight checks before iterating over
all characters or checking for profanities.

Also remove double negations to make the boolean
expression more readable.
Copy link
Contributor

@oddgrd oddgrd left a comment

Choose a reason for hiding this comment

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

This looks great to me, thanks! And thanks for the tests and thorough comments! Regarding the deployer handlers, as far as I can tell it looks like we're good.

cargo-shuttle/src/lib.rs Outdated Show resolved Hide resolved
@jonaro00 jonaro00 changed the title feat: custom Path extractor for ProjectName parsing feat: fix ProjectName validation, custom Path extractor for parsing it Nov 3, 2023
@jonaro00 jonaro00 changed the title feat: fix ProjectName validation, custom Path extractor for parsing it refactor: fix ProjectName validation, custom Path extractor for parsing it Nov 3, 2023
Copy link
Member

@chesedo chesedo left a comment

Choose a reason for hiding this comment

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

One suggestion. Btw, nicely done with the new tests

common/src/project.rs Outdated Show resolved Hide resolved
Copy link
Member

@chesedo chesedo left a comment

Choose a reason for hiding this comment

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

LGTM

@jonaro00 jonaro00 merged commit dd6b8fe into main Nov 3, 2023
34 checks passed
@jonaro00 jonaro00 deleted the project-name-extractor branch November 3, 2023 16:27
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.

None yet

4 participants