Skip to content

Commit

Permalink
Added type to regex
Browse files Browse the repository at this point in the history
  • Loading branch information
jtesch committed Jan 8, 2020
1 parent 85d59eb commit 0b73160
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion graphene_federation/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _mark_field(
# todo write tests on regexp
schema_field_name = to_camel_case(field_name) if auto_camelcase else field_name
pattern = re.compile(
r"(\s%s\s[^\{]*\{[^\}]*\s%s[\s]*:[\s]*[^\s]+)(\s)" % (
r"(type\s*%s\s[^\{]*\{[^\}]*\s%s[\s]*:[\s]*[^\s]+)(\s)" % (

This comment has been minimized.

Copy link
@erebus1

erebus1 Jan 9, 2020

You should use \s+ instead of \s*
Otherwise, it can be a mismatch when you have:

  1. type MyObject
  2. type typeMyObject
entity_name, schema_field_name))
schema = pattern.sub(
rf'\g<1> {decorator_resolver(getattr(field, mark_attr_name))} ', schema)
Expand Down

0 comments on commit 0b73160

Please sign in to comment.