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

feat: unique accept options as object #1012

Merged
merged 4 commits into from
Dec 4, 2024
Merged

Conversation

Xstoudi
Copy link
Contributor

@Xstoudi Xstoudi commented Mar 11, 2024

πŸ”— Linked issue

#995

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Current unique rule becomes uniqueRaw as proposed by @thetutlage on #995 and we add a new unique allowing a simpler and more expressive API inspired from Adonis v5.

Feel free to comment the implem, I'm not fully familiar with Adonis codebase. I couldn't found the doc about future old unique rule, can you show me where it's mentionned in the doc so I can update the doc?

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@thetutlage
Copy link
Member

Hey, both unique and uniqueRaw could be the same overload function. Because, right now this PR will lead to a breaking change, and that's something we should avoid.

Also let's add some tests for the new implementation.

Feel free to comment the implem, I'm not fully familiar with Adonis codebase. I couldn't found the doc about future old unique rule, can you show me where it's mentionned in the doc so I can update the doc?

Haha, seems like it never got documented. So we will have to document it from scratch.

@Xstoudi
Copy link
Contributor Author

Xstoudi commented Mar 12, 2024

It use overload now.

I'm not sure how to get started to write test for a binding and for as much as I looked, I cannot use previous test to get inspiration because they do not exist (or I can't find it).

Where do you think we should document it? On the Lucid doc with a Rules contributed by Lucid like this:https://docs.adonisjs.com/guides/validation#rules-contributed-by-adonisjs ?

@flozdra
Copy link

flozdra commented Nov 13, 2024

Hello, will it be merged soon?

I have two questions:

  • Can we add a caseInsensitive option like in the previous Lucid version?
  • What do you think about adding the same Options parameter to the exists rule?

I can open another PR if you want.

@thetutlage
Copy link
Member

Sorry slept on the PR for quite long as did not have the energy to manage multiple things.

I will merge this PR and then do other improvements like adding caseInsensitive and bringing the same options to the exists validation rule

@thetutlage thetutlage merged commit 62a1ba5 into adonisjs:21.x Dec 4, 2024
16 checks passed
@Xstoudi Xstoudi deleted the feat/unique branch December 4, 2024 10:01
@thetutlage thetutlage changed the title feat: uniqueRaw and unique feat: unique accept options as object Dec 4, 2024
@thetutlage
Copy link
Member

Improved both the validations. 761f823

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.

4 participants