graphql-python / graphql-core-legacy

GraphQL base implementation for Python (legacy version – see graphql-core for the current one)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow constant names with dash

gildub opened this issue · comments

Would it be possible to flex the following assert_valid_name check and allow dash?
https://github.com/graphql-python/graphql-core/blob/master/graphql/utils/assert_valid_name.py#L3

For example using the following:

NAME_PATTERN = r"^[_a-zA-Z][_\-a-zA-Z0-9]*$"

The reason behind is it's breaking https://review.openstack.org/#/c/575898/16.

The typical error would be:

.../...
File "/home/gildub/github/openstack/neutron/.tox/py27/lib/python2.7/site-packages/graphql/utils/assert_valid_name.py", line 12, in assert_valid_name
    ), 'Names must match /{}/ but "{}" does not.'.format(NAME_PATTERN, name)
AssertionError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "dhcpv6-stateful" does not.

That would be against the GraphQL spec https://spec.graphql.org/June2018/#sec-Names