From b176929557b1379a8e64e5c3f452795f3b1222af Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 29 Sep 2022 19:27:57 +1300 Subject: [PATCH] Sort schema --- src/Appwrite/GraphQL/SchemaBuilder.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/GraphQL/SchemaBuilder.php b/src/Appwrite/GraphQL/SchemaBuilder.php index baaeb75418..65686304bd 100644 --- a/src/Appwrite/GraphQL/SchemaBuilder.php +++ b/src/Appwrite/GraphQL/SchemaBuilder.php @@ -70,20 +70,26 @@ class SchemaBuilder $register->set($collectionsDirtyKey, static fn() => false); } + $queryFields = \array_merge_recursive( + $apiSchema['query'], + $collectionSchema['query'] + ); + $mutationFields = \array_merge_recursive( + $apiSchema['mutation'], + $collectionSchema['mutation'] + ); + + \ksort($queryFields); + \ksort($mutationFields); + $schema = new Schema([ 'query' => new ObjectType([ 'name' => 'Query', - 'fields' => \array_merge_recursive( - $apiSchema['query'], - $collectionSchema['query'] - ) + 'fields' => $queryFields ]), 'mutation' => new ObjectType([ 'name' => 'Mutation', - 'fields' => \array_merge_recursive( - $apiSchema['mutation'], - $collectionSchema['mutation'] - ) + 'fields' => $mutationFields ]) ]);