GraphQL schema name collision caused by autogenerated Order
input parameter
#8802
Labels
type:feature
New feature or improvement of existing feature
New Issue Checklist
Issue Description
When autogenerating the GraphQL schema, Parse creates input types for each class. All the generated input types has a trailing
Input
word. Except for theOrder
input type. Meaning that if you have a class calledItem
the sorting input type will be calledItemOrder
This becomes problematic since it is common, when for example, building e-commerce sites, to have collections ending with "Order" (as in buy-order). ItemOrder, GiftCardOrder etc.
Because of this, if you have two classes called
Item
andItemOrder
it will cause a name collision in the schema. The result of this being thatItemOrder
(the collection) defaults its type toObject
causing an error when trying to access its collection properties through the GraphQL API.Here is an example of how creating a class called
Item
reserving the type nameItemOrder
If we also have a
ItemOrder
collection, it logs this warning:And the type for the
ItemOrder
(collection) query is:Steps to reproduce
Solutions
A potential solution is to follow the naming conventions parse already uses for the other input types. Meaning that we can add
Input
to the end.Example:
It should be noted that this is a breaking change if the input type is being used as follows:
This would have to be changed to this:
The text was updated successfully, but these errors were encountered: