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

Should attribute names be allowed to start with a digit? #1285

Closed
duglin opened this issue May 22, 2024 · 3 comments · Fixed by #1287
Closed

Should attribute names be allowed to start with a digit? #1285

duglin opened this issue May 22, 2024 · 3 comments · Fixed by #1287

Comments

@duglin
Copy link
Collaborator

duglin commented May 22, 2024

Today the spec says:

In order to maximize the likelihood of interoperability and portability across transport protocols and
messaging formats, CloudEvents attribute names MUST consist of lower-case letters ('a' to 'z') or
digits ('0' to '9') from the ASCII character set. Attribute names SHOULD be descriptive and terse
and SHOULD NOT exceed 20 characters in length.

Normally digits aren't great as first characters of identifiers.

If we want to restrict it w/o breaking the spec we could say they "SHOULD start with a-z" instead of "MUST"

@embano1
Copy link
Member

embano1 commented May 22, 2024

Normally digits aren't great as first characters of identifiers

True from personal preference (human perspective) - but is there a technical reason why a machine would care?

If we want to restrict it w/o breaking the spec we could say they "SHOULD start with a-z" instead of "MUST"

Is there any prior art where this has become a problem after the fact?

@duglin
Copy link
Collaborator Author

duglin commented May 22, 2024

The scenario that keeps popping in my head is one where someone tries to map CE attributes to programming language variables... and 9x isn't a valid variable name, and often not allowed as a structure property name. Which means people would need some kind of mapping. Possible, but a pain for people who are trying to support things in a generic way.

@embano1
Copy link
Member

embano1 commented May 22, 2024

Wasn't aware of mapping attributes to variable names (how would that work?). For structures I agree but IMHO extension attributes are supposed to be (parsed as) strings so any (?) map type (with string keys) in a programming language should work?

duglin pushed a commit to duglin/spec that referenced this issue May 23, 2024
Fixed cloudevents#1285

Signed-off-by: Doug Davis <dug@microsoft.com>
duglin pushed a commit to duglin/spec that referenced this issue May 23, 2024
Fixed cloudevents#1285

Signed-off-by: Doug Davis <dug@microsoft.com>
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 a pull request may close this issue.

2 participants