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

Support range/length refinement providers for enums #1283

Merged
merged 6 commits into from
Nov 2, 2023

Conversation

Baccata
Copy link
Contributor

@Baccata Baccata commented Oct 31, 2023

Fixes #1282

PR Checklist (not all items are relevant to all PRs)

  • Added bootstrapped code
  • Updated changelog

@@ -82,6 +83,12 @@ object RefinementProvider {
implicit def mapLengthConstraint[K, V]: Simple[Length, Map[K, V]] =
new LengthConstraint[Map[K, V]](_.size)

implicit def enumLengthConstraint[E <: Enumeration.Value]: Simple[Length, E] =
Copy link
Member

Choose a reason for hiding this comment

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

question: should we also have @pattern?

Copy link
Member

Choose a reason for hiding this comment

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

@idRef would be nasty. If someone ever creates an enum that matches the ShapeId format, I'll personally go to their house and remove their github account.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

question: should we also have @pattern?

Is it allowed ? you mentioned range and length, but ...

Copy link
Member

Choose a reason for hiding this comment

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

I didn't check the others! 😅

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Jakub Kozłowski <kubukoz@gmail.com>
@kubukoz kubukoz merged commit 45970f5 into series/0.18 Nov 2, 2023
11 checks passed
@kubukoz kubukoz deleted the support-range-and-length-on-enum-fields branch November 2, 2023 23:04
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.

Invalid code generated when constraints on enums are used
2 participants