spec: String type: "printable Unicode characters" and follow-on problems

Previous discussion started by @evankanderson here: https://github.com/cloudevents/spec/pull/456#issuecomment-507860941 and in the following comments. Also, here: https://github.com/cloudevents/spec/pull/471/files#r312744230 and here: https://github.com/cloudevents/spec/pull/482#issuecomment-520437625

The String type currently only allows “printable” Unicode characters.

There are multiple problems:

  • As @evankanderson has pointed out, while “printable” is defined for ASCII, it isn’t clear what it means in Unicode.
  • One may assume that space is not “printable” (but per ASCII, it is)
  • We can’t use String for the data attribute. The most obvious reason is that line breaks can’t be used, which is an issue for plain text, but also if we want to model JSON, XML or CSV as String.

String is used in three places:

  • As a key for Map. The “printable” requirement makes sense (and may be even to weak?)
  • As a value in regular attributes. The “printable” requirement makes sense, or we’d have to rework our HTTP transport a bit (as headers are terminated by a line break).
  • As a value in data. The requirement is too restrictive.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments