How to add description to fields?
It is connected to #208, to this comment Let's say I have this model:
class Country(models.Model):
code = models.CharField(max_length=5, null=True)
name = models.CharField(max_length=100, null=True)
and in schema i have
class CountryNode(DjangoObjectType):
class Meta:
model = Country
description = "This is a Country Node"
I can add a description for CountryNode itself, but how to do it for Country code and name?
code = models.CharField(max_length=5, null=True, help_text="This is a code field")
you can define a field with same name in your DjangoObjectType if you do not want update the model 😄
class CountryNode(DjangoObjectType):`
class Meta:
model = Country
description = "This is a Country Node"
code = graphene.String(description="This is a code field")
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing this issue @Dawidpol because @dan-klasson and @liupengf12 have provided some solutions to the problem.