0

Right now I have a django model.

class MyModel(models.Model, GetMixin):

    logo_url = models.URLField()

And attached it up to DjangoObjectType.

class MyModelType(DjangoObjectType):

    class Meta:
        model = MyModel

Now I need to change the field name of logo_url of response to look like this --logo-url instead of logoUrl so I can have this desired result.

{
    "data": {
        "myData": {
            "site": {
                "--logo-url": "https://www.company.com/logo.png"
            }
        }
    }
}

UPDATES

This feature is very hard to achieve! I was able to get ahold of extending an objecttype meta and successfully composed the desired field name structure but graphene standard won't allow me to do so:

AssertionError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "--logo-url"
does not.
Shift 'n Tab
  • 8,808
  • 12
  • 73
  • 117

1 Answers1

0

You're trying to change the schema to use characters that are not allowed in graphQL. Graphene is raising an AssertionError because it follows the graphQL standard.

See Special characters in GraphQL schema

Mark Chackerian
  • 21,866
  • 6
  • 108
  • 99