-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise documentation #969
Revise documentation #969
Conversation
Tried to optimize for first time user experience by explaining some basic GraphQL concepts and putting more explicit linking between relevant parts of the documentation and the open source documentation. Documented some undocumented features for ObjectType Meta class. There could be more work to be done to keep a light introduction to Graphene concepts that goes from Broad, High level concepts (ex. Schema) to more specific (ObjectType, then Fields). If we had an API reference then we could focus on making a really streamlined first time user experience and then document edge cases and specific API's in the API reference instead of the main body of documentation. |
Resolver arguments are inconsistent in documentation - sometimes indicated as I did some research in other libraries and documentation and found a couple of different terms that are used. I've listed them in an order that ranks them in how descriptive and accurate they are to describe this first resolver argument.
In any event, Let's try to align on one term to use across the documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic @dvndrsn ! Thank you so much! I've added some comments but let's get this merged in as soon as possible.
Regarding the naming for the "parent" argument for resolvers: my 2 cents is that it should be named after the object it's expecting to get (so person
in the case of the Person
type). I've written up more about it here: #921 (comment)
docs/types/objecttypes.rst
Outdated
Each field on an *ObjectType* in Graphene should have a corresponding resolver method to fetch data. This resolver method should match the field name. For example, in the ``Person`` type above, the ``full_name`` field is resolved by the method ``resolve_full_name``. | ||
|
||
Each resolver method takes the parameters: | ||
* :ref:`ResolverRootArgument` for the value object use to resolve most fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResolverParent
? Since that is what you are calling it later. Also drop the Argument
(or replace with Parameter
) because the term arguments is also used to refer to the "arguments" to a field in the schema.
docs/types/objecttypes.rst
Outdated
* This value object is then used as ``parent`` while calling ``Person.resolve_full_name`` to resolve the scalar String value "Luke Skywalker". | ||
* The scalar value is serialized and sent back in the query response. | ||
|
||
Each resolver returns the next :ref:`ResolverRootArgument` to be used in executing the following resolver in the chain. If the Field is a Scalar type, that value will be serialized and sent in the **Response**. Otherwise, while resolving Compound types like *ObjectType*, the value be passed forward as the next :ref:`ResolverRootArgument`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏 👏
- Add missing reference to `flask-graphql` in integrations - align documentation for resolver arguments (use root for 1st argument instead of self) - explore use of `parent` instead of `root` for first argument - clarify resolvers and object type documentation - add documentation for Meta class options for ObjectType - expand quickstart documentation for first time users - streamline order of documentation for first time users (broad -> specific) - document resolver quirks
9d71a9e
to
a6ac7d4
Compare
@jkimbo, incorporated your suggestions. @phalt @changeling - any feedback? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
flask-graphql
in integrationsinstead of self)
parent
instead ofroot
for first argumentspecific)