specification icon indicating copy to clipboard operation
specification copied to clipboard

Enforce naming conventions

Open cdavernas opened this issue 1 year ago • 1 comments

What would you like to be added:

Enforce naming conventions of most (if not all) components.

I propose that we enforce using snake and/or kebab cased names.

Why is this needed:

In the case of functionDefs of type expression, for example, not enforcing a naming convention makes expression parsing a huge mess.

Consider the following example:

functions:
  - name: Say Hello
    type: expression
    operation: 'Hello!'

Now to call the function in an expression as defined by the spec, you'd need to write something like:

. | . * { "greetings": "fn:Say Hello" }

... which is impossible to parse both properly and/or safely. We could of course mandate to put the function's name between parenthesis (ex: $fn:(Say Hello)), for example, but I think the easier and cleanier approach is to go with a naming convention

cdavernas avatar Sep 09 '22 12:09 cdavernas

Agree, will do pr for it

tsurdilo avatar Sep 12 '22 04:09 tsurdilo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 29 '22 00:10 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 30 '22 00:12 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 21 '23 00:02 github-actions[bot]

Let's use Kubernetes convention for naming: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/

They are based on RFC1123, so it's safe for DNS too.

ricardozanini avatar May 23 '23 13:05 ricardozanini

Let's use Kubernetes convention for naming: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/

They are based on RFC1123, so it's safe for DNS too.

Hmmm, I think we should support _ for naming, without the need of escaping it

fjtirado avatar Jun 07 '23 16:06 fjtirado

I think we should allow _ in the id, there is always the possibility of mapping it to - when being used as k8s label. Besides that I think ids can include more special characters than functions (-,_,&,!) For functions, as a developer, I would ban most of special characters: &, |, @, &, ?, $, (, ), {,}, [,], +, -, because they might appear in a jq expression, so to make things simpler I vote for snake (which uses _, not -, which might be interpreted as minus operation) and allowing the same chars that JQ does (letter, numbers and of course _)

fjtirado avatar Jun 07 '23 16:06 fjtirado