You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
common/naming.py: a GraphQL-encoded name can begin with the reserved '__' prefix, and the warning reports the unencoded name #65
NameCompatibility with the GraphQL profile can produce names that begin with __, a prefix GraphQL reserves for introspection (October 2021, §2.1.9). Two paths in packages/linkml/src/linkml/generators/common/naming.py do it:
_no_heading_digits prefixes a digit-leading name with __, giving __0, __1, __3_prime_utr.
_only_alphanum_underscore / _transform_char replaces a character that is not alphanumeric with its Unicode name wrapped in __. When that character is first, the name begins with __: __PLUS_SIGN__, __HYPHEN_MINUS__, __FULL_STOP__, __QUESTION_MARK__.
Both reach the biolink reference snapshot. After #63 the snapshot parses, and these are nine of its remaining validation errors:
Name '__0' must not begin with '__', which is reserved by GraphQL introspection.
Name '__PLUS_SIGN__' must not begin with '__', which is reserved by GraphQL introspection.
Note the substitution is only a problem at the start of a name: an enum value such as AD-02 encodes to AD__HYPHEN_MINUS__02, which is legal.
A separate cosmetic bug belongs with this one. Both functions log outputbefore the encoding is assigned to it, so the warning reports the unencoded name as the encoded one:
WARNING:root:Name 'AD-02' contains a character illegal in GraphQL, the resulting encoded name is AD-02
That makes the warning useless for diagnosing exactly the names this issue is about, and it is noisy: a single run over a schema with ISO 3166-2 region codes emits it thousands of times.
NameCompatibility is used only by graphqlgen (grep-verified), so a fix is contained and cannot disturb another generator. Upstream linkml/linkml has since added Python-keyword helpers to this module but has not touched either path.
Activity