Skip to content

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>
@jiparis jiparis requested review from javirln and migmartri November 20, 2024 16:46
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