stargate / data-api

JSON document API for Apache Cassandra (formerly known as JSON API)
https://stargate.io
Apache License 2.0
14 stars 16 forks source link

Allow use of colon (`:`) character in property names/paths #1120

Open tatu-at-datastax opened 6 months ago

tatu-at-datastax commented 6 months ago

Currently we allow a small set of characters in the path names (regex [a-zA-Z0-9_\-]*). Some characters are excluded by design ($ is reserved for operators and special fields; . is path separator) but many are left out just because we want to be careful of never having to go back to excluding something we have allowed. There was also some concern about keeping character set limited to allow possible mapping to underlying physical Cassandra columns in future (not sure if that is concern any more).

One specific character that seems useful and safe to allow is colon (:). So I suggest we add it as an allowed path segment character.

tatu-at-datastax commented 6 months ago

@amorton @maheshrajamani WDYT?

vkarpov15 commented 5 months ago

I took a look and MongoDB does support : in property names. I don't see any reason to avoid supporting : from my perspective, but I'll defer to @amorton

MongoDB Enterprise > db.test.findOne({ ':': 42 })
null
MongoDB Enterprise > db.test.insertOne({ ':': 42 })
{
    "acknowledged" : true,
    "insertedId" : ObjectId("665f5a7f601e93e9dea81748")
}
MongoDB Enterprise > db.test.find()
{ "_id" : ObjectId("665f3353716ac3d79e8fa439"), "x:y" : 42 }
{ "_id" : ObjectId("665f5a7f601e93e9dea81748"), ":" : 42 }
MongoDB Enterprise > 
amorton commented 5 months ago

Hold on this until we chat, there are implications for interacting with CQL column names.

tatu-at-datastax commented 5 months ago

Yes, was not planning on proceeding until we sync on this one.