Skip to content

add ulid routing Constraint#2782

Closed
alfadhela wants to merge 1 commit intogofiber:masterfrom
alfadhela:ulid-constraint
Closed

add ulid routing Constraint#2782
alfadhela wants to merge 1 commit intogofiber:masterfrom
alfadhela:ulid-constraint

Conversation

@alfadhela
Copy link

Description

Add new constraint for ulid using github.com/oklog/ulid/v2 pkg.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • For new functionalities I follow the inspiration of the express js framework and built them similar in usage
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation - /docs/ directory for https://docs.gofiber.io/
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • If new dependencies exist, I have checked that they are really necessary and agreed with the maintainers/community (we want to have as few dependencies as possible)
  • I tried to make my code as fast as possible with as few allocations as possible
  • For new code I have written benchmarks so that they can be analyzed and improved

Commit formatting:

Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md

@welcome
Copy link

welcome bot commented Jan 3, 2024

Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@ReneWerner87
Copy link
Member

image
hi, as already mentioned here, we want to include as few dependencies as possible in the core

thanks for the effort, but another solution to minimize this external dependency for everyone would be better for the core
e.g. about the possibility to add other contrains from outside

@ReneWerner87
Copy link
Member

you are welcome to work on it in the beta branch for version 3

we don't want new feature requests for v2 at the moment, because we want to stop the development there for now

@alfadhela
Copy link
Author

alfadhela commented Jan 3, 2024

No problem but is it acceptable if I write regexp for ulid instead of using oklog/ulidpkg.

@ReneWerner87
Copy link
Member

well, then the exam would only be half right
since there are many possibilities for contrains, but we shouldn't cover them all within the core, i think you should make them expandable

we can't possibly include all patterns, such as uuidv3, uuidv4, ulid etc.

to solve the problem on your side/project, however, you could use a regex contrain in your route

@alfadhela
Copy link
Author

It's a solution.
If I can suggest to make route constraint plugable similar to go-playground/validator.
I'll try to create a PR if it's acceptable.

@alfadhela
Copy link
Author

Hi @ReneWerner87,
After trying to add regex(expression) I faced a new issue, in path all constraints will be lower-case. the solution is to add config.CaseSensitive = true to fiber.App() which is not ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants