Skip to content

is_valid_label fails to validate label type, while is_valid_label_name is calling into is_valid_label, should be the other way around #1985

@MironAtHome

Description

@MironAtHome

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions