tarantool / ddl

The DDL module enables you to describe data schema in a declarative YAML-based format.
BSD 2-Clause "Simplified" License
12 stars 6 forks source link

Types map and array and JSON path are not support in DDL schema #81

Open ligurio opened 2 years ago

ligurio commented 2 years ago

Types map, array and JSON path are not supported in DDL schema. We need to describe it in DDL documentation.

https://github.com/tarantool/ddl/blob/master/ddl/check.lua#L720-L746

    -- check sharding_key path is valid
    for _, path_to_field in ipairs(space.sharding_key) do
        local path = get_path_info(path_to_field)
        if path.type ~= 'regular' then
            return nil, string.format(
                "spaces[%q].sharding_key[%q]: key containing JSONPath isn't supported yet",
                space.name, path_to_field
            )
        end

        local field = space.fields[path.field_name]
        if not field then
            return nil, string.format(
                "spaces[%q].sharding_key[%q]: invalid reference to format[%q], no such field",
                space.name, path_to_field, path.field_name
            )
        end

        if field.type == 'map' or field.type == 'array' then
            return nil, string.format(
                "spaces[%q].sharding_key[%q]: key references to field " ..
                "with %s type, but it's not supported yet",
                space.name, path_to_field, field.type
            )
        end
    end
    return true
end