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

API Spec Should Provide Source and/or Description of RegEx Validation #3306

Closed
robscott opened this issue Aug 30, 2024 · 6 comments · Fixed by #3321
Closed

API Spec Should Provide Source and/or Description of RegEx Validation #3306

robscott opened this issue Aug 30, 2024 · 6 comments · Fixed by #3321
Assignees
Labels
kind/documentation Categorizes issue or PR as related to documentation.
Milestone

Comments

@robscott
Copy link
Member

What would you like to be added:
Ideally the API spec should have more information about RegEx validation, for example where it came from or what it's based on. This should be visible in go type definitions but hidden from the generated CRD.

Why this is needed:
We rely heavily on RegEx validation and it can be difficult to ensure that our validation is well aligned with the relevant RFC or k8s concept. A simple reference or description of how we landed at a specific RegEx would be very helpful for future readers. Since we already have custom CRD gen, it would be relatively simple to build something like this to enable the concept:

startTag := "<gateway:experimental:description>"
endTag := "</gateway:experimental:description>"

@robscott robscott added the kind/documentation Categorizes issue or PR as related to documentation. label Aug 30, 2024
@LiorLieberman
Copy link
Member

For #3304 the regex is taken from the RFC (link) but has been slightly modified to enforce a full URI and not relative.

@LiorLieberman
Copy link
Member

@Devaansh-Kumar are you interested in taking this?

@LiorLieberman
Copy link
Member

@robscott my understanding of this request is that we want to add a note for where we took the regex from, but we dont want this in the CRD. I believe we can generalize this to more than just a regex but all comments we want to add on the go struct but not on the CRD. Just making sure we are on the same page?

@robscott
Copy link
Member Author

robscott commented Sep 3, 2024

@robscott my understanding of this request is that we want to add a note for where we took the regex from, but we dont want this in the CRD. I believe we can generalize this to more than just a regex but all comments we want to add on the go struct but not on the CRD. Just making sure we are on the same page?

Yep, I don't think we want to overuse this pattern and have comments for anything, but agree that the overall pattern can/should be generalized any time we want to have comments like this.

@Devaansh-Kumar
Copy link
Contributor

Devaansh-Kumar commented Sep 5, 2024

@Devaansh-Kumar are you interested in taking this?

Yes @LiorLieberman, I can take this up.

@Devaansh-Kumar
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation.
Projects
4 participants