I am looking for a way to include extra info in the schema so the API consumer knows what is expected. Think along the lines of a max length on a string or something. I expect this to be in the schema since that basically replaces the API documentation, right?
I have found this: https://github.com/confuser/graphql-constraint-directive which appears to be similar to what I want, however I don't need the implementation/enforcement since django does that already. I just want to communicate these constraints on input fields.
I am very new to this all, so is there maybe a concept of graphql I am missing? Or how do I add this kind of information in the schema?
EDIT: Maybe this is not only for documenting, but also to tell the frontend how to render fields and/or be able to do some frontend validation. Basically like an OPTIONS request or something.
If all you're looking to do is to document something about a specific field or type, you can set a description
on either one. Adding a description doesn't seem to be outlined in the official docs, but there is this issue about it.
class MyType(graphene.ObjectType):
class Meta:
description = "Some description for MyType"
my_field = graphene.String(description="Some description for myField")