purely coding issue.
Function is_valid_label should be validating whether label exists, inspecting label type.
In addition to label name, it should be accepting parameter graph name, as well.
Function is_valid_label_name should only check string against length and pattern, and used in is_valid_label for name part validation, prior passing request to function label_exists(label_name, graph_oid)
As a separate note, which was result of this code study, found the discrepancy between this function check approach, using macro
OidIsValid
and macro
label_id_is_valid(id) (id >= LABEL_ID_MIN && id <= LABEL_ID_MAX)
While there is a bit of difference between the two checks, in addition Oid is unsigned integer of 32 bit width, whilst label id currently defined as int32, which would make it a signed integer, which places the numeric expression for the two objects into different address space.
It would be very nice to clarify and settle on a common approach to id scheme.