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 for Parameter Options in Parameterized Path #5633

Open
sato9818 opened this issue Apr 24, 2024 · 0 comments
Open

Support for Parameter Options in Parameterized Path #5633

sato9818 opened this issue Apr 24, 2024 · 0 comments

Comments

@sato9818
Copy link
Contributor

Recommended by @trustin.

Background

To improve the flexibility of parameterized path, it would be very useful to support detailed parameter options for validation.
This feature would allow specifying additional constraints directly in the path, such as type, length, range, and custom patterns.

Example

Examples of the proposed syntax include:

  • /foo/{bar:type=int,range=[0,10]}/ - Validates that bar is an integer within the range of 0 to 10.
  • /foo/{bar:type=string,max_len=10}/ - Validates that bar is a string with a maximum length of 10 characters.
  • /foo/{bar:type=string,pattern=^[0-9-]+$}/ - validates that bar matches the specified regex pattern.

implementation

To implement this feature, we might consider adding a new parsing method in the ParameterizedPathMapping class.
Also, we might need a new class that is responsible for applying the specified validations on the input values.

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

No branches or pull requests

1 participant