graphql-python / graphql-core-legacy

GraphQL base implementation for Python (legacy version – see graphql-core for the current one)
MIT License
374 stars 183 forks source link

Allow constant names with dash #218

Closed gildub closed 4 years ago

gildub commented 5 years ago

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.

gildub commented 5 years ago

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.
Cito commented 4 years ago

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