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

chore: add requirement validation #1559

Merged
merged 5 commits into from
Dec 2, 2024
Merged

Conversation

jiparis
Copy link
Member

@jiparis jiparis commented Nov 20, 2024

This PR adds some validation to the requirement IDs, allowing only non space characters an 1 @ only to split versions.

Closes #1558

Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
repeated string requirements = 6;
repeated string requirements = 6 [(buf.validate.field).repeated.items = {
string: {
pattern: "^[^\\s@]+(@[^\\s@]+)?$", // whitespaces not allowed, lock is optional (@)
Copy link
Member

Choose a reason for hiding this comment

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

I know that I said we should force it but now I am wondering if we should be lax by default as you did. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but at least I would force the @ for the version separator (or /, or :, anything), as we do in other places

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated the rule to have a mandatory requirement prefix for grouping them into frameworks, groups, or similar. myframework/myrequirement@version

Copy link
Member

@migmartri migmartri left a comment

Choose a reason for hiding this comment

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

thanks

@jiparis jiparis merged commit 2fda84d into chainloop-dev:main Dec 2, 2024
13 checks passed
@jiparis jiparis deleted the 1558-reqis branch December 2, 2024 13:06
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.

Validate requirement ID
2 participants