Skip to content

describe a node's type as a string #87

@davidism

Description

@davidism

When testing, you may want to check the type of a node as it will appear in the final GraphQL schema. If you've called schema.to_graphql() to finalize the types, then because of caching you can do node1.type is User.non_null.list and it will compare equal by identity. But this won't work for wrapping types that were created from string references, such as NonNull("User").list, because only the properties can cache.

It would be useful to always get the node's type as a string, such as "[User!]", regardless of if you specified the type as a string or an instance. Add a type_str property to make it possible to do node.type_str == "[User!]".

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions