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

Confirm - design for createIndex #1675

Open amorton opened 1 week ago

amorton commented 1 week ago

The current create index command (for regular indexes on text, numbers etc) looks like :

{
    "createIndex": {
        "name" : "users_country",
        "definition" : {
            "column" : "country", 
            "options": {
                "ascii" : "true"
                }
        }
    }
}

NOTE: the options are under the definition element, the options are only there for text/ascii indexes and they are ascii, normalize, caseSensitive.

This is per the design from sept.

But looking at this, it looks like "Unnecessary Nesting" (TM) and perhaps we should have they under the definition ?

Other than UN (see above) there is already an options clause for the command, so this is also a case of "Double Options" (TM)

{
    "createIndex": {
        "name" : "users_country",
        "definition" : {
            "column" : "country", 
            "options": {
                "normalize" : "true"
                }
        },
        "options": {"ifNotExists": true}
    }
}
vkarpov15 commented 4 days ago

My 2 centers: I would expect options to be a top-level property rather than as definition.options in this case. Not a dealbreaker either way, just that's what I would expect as a developer integrating against this API.