From b37fd9ead775281f05ad73b242d37e0d51e7b77d Mon Sep 17 00:00:00 2001 From: Klaus Purer Date: Sat, 3 Aug 2024 11:13:08 +0200 Subject: [PATCH] style(cspell): Fix misspelled words (#1416) --- .cspell-project-words.txt | 5 +++++ doc/mutations/README.md | 6 +++--- doc/mutations/validations.md | 6 +++--- doc/producers/README.md | 14 +++++++------- doc/producers/composing.md | 2 +- doc/producers/custom.md | 2 +- doc/starting/custom-schema.md | 6 +++--- src/Controller/VoyagerController.php | 2 +- src/GraphQL/Execution/ExecutionResult.php | 2 +- src/GraphQL/Validator.php | 8 ++++---- src/Plugin/DataProducerPluginCachingInterface.php | 2 +- .../GraphQL/DataProducer/String/Uppercase.php | 2 +- .../DataProducer/Taxonomy/TaxonomyLoadTree.php | 2 +- .../graphql_alterable_schema_test.info.yml | 2 +- .../Kernel/DataProducer/EntityReferenceTest.php | 2 +- tests/src/Kernel/DataProducer/EntityTest.php | 1 + tests/src/Kernel/DataProducer/RoutingTest.php | 1 + .../src/Kernel/Framework/PersistedQueriesTest.php | 1 + tests/src/Kernel/Framework/TestFrameworkTest.php | 1 + tests/src/Kernel/ResolverRegistryTest.php | 1 + tests/src/Traits/QueryResultAssertionTrait.php | 2 +- 21 files changed, 40 insertions(+), 30 deletions(-) create mode 100644 .cspell-project-words.txt diff --git a/.cspell-project-words.txt b/.cspell-project-words.txt new file mode 100644 index 000000000..4303e1a55 --- /dev/null +++ b/.cspell-project-words.txt @@ -0,0 +1,5 @@ +dataproducer +dataproducers +GraphiQL +graphqls +webonyx diff --git a/doc/mutations/README.md b/doc/mutations/README.md index 2555146f8..fa8ea26d3 100644 --- a/doc/mutations/README.md +++ b/doc/mutations/README.md @@ -29,7 +29,7 @@ input ArticleInput { } ``` -And now in our `.exntends.graphqls` file we will extend the Mutation type to add our new mutation. This is so that in the future other modules can also themselves extend this type with new mutations keeping things organized. +And now in our `.extends.graphqls` file we will extend the Mutation type to add our new mutation. This is so that in the future other modules can also themselves extend this type with new mutations keeping things organized. ``` extend type Mutation { @@ -137,10 +137,10 @@ class CreateArticle extends DataProducerPluginBase implements ContainerFactoryPl } ``` -### Important note +### Important note One thing to notice when creating mutations like this is that Access checking needs to be done in the mutation, for queries this usually is done in the -data producer directly (e.g. `entity_load` has access checking built-in) but because we are programatically creating +data producer directly (e.g. `entity_load` has access checking built-in) but because we are programmatically creating things we need to check the user actually has access to do the operation. ## Calling the mutation diff --git a/doc/mutations/validations.md b/doc/mutations/validations.md index 15707c7ae..e30ea18c6 100644 --- a/doc/mutations/validations.md +++ b/doc/mutations/validations.md @@ -49,7 +49,7 @@ We define a Violation scalar which will just hold the error messages that will b ## Create the ArticleResponse class -Because we need adition content inside our Response we make a class that implements the module's ResponseInterface. Inside it will have a `article` property (like we saw before). This will be added in the `src/Wrappers/Response` folder and we will call it `ArticleResponse.php` +Because we need additional content inside our Response we make a class that implements the module's ResponseInterface. Inside it will have a `article` property (like we saw before). This will be added in the `src/Wrappers/Response` folder and we will call it `ArticleResponse.php` ```php @@ -207,7 +207,7 @@ We have added a new type that is returned `$response` where we call the `setArti ## Resolve errors and article -To resolve our fields similar to before we go to our schema implementation again and add the resolvers for the +To resolve our fields similar to before we go to our schema implementation again and add the resolvers for the `ArticleResponse` we created (what the mutation now returns back): ```php @@ -232,7 +232,7 @@ public function registerResolvers(ResolverRegistryInterface $registry) { } ``` -And that's it if we now call this mutation for example as an anonymous user (if we set aribtrary queries enabled in the permissions for the module) we should get an error : +And that's it if we now call this mutation for example as an anonymous user (if we set arbitrary queries enabled in the permissions for the module) we should get an error : ```json { diff --git a/doc/producers/README.md b/doc/producers/README.md index 7e02fe157..009b80b67 100644 --- a/doc/producers/README.md +++ b/doc/producers/README.md @@ -4,11 +4,11 @@ The 4.x version of the Drupal GraphQL module is built on top of a concept called A data producer is more or less a function that takes arguments (either from an end user query or static) and resolves these into some other data, for example taking an entity (such as a node) and giving back a particular field. -Lets imagine we want to make a custom field available for a schema, in this case we have an `author` field in the "Article" content type. For this field we can have a producer that takes an entity and returns or resolves the creator field. Let's apply this to our custom schema which alreay defines an "Article" type. +Lets imagine we want to make a custom field available for a schema, in this case we have an `author` field in the "Article" content type. For this field we can have a producer that takes an entity and returns or resolves the creator field. Let's apply this to our custom schema which already defines an "Article" type. ## Add the field to the schema -In your `.graphqls` file add the schema defintion +In your `.graphqls` file add the schema definition ``` type Article { @@ -44,7 +44,7 @@ $registry->addFieldResolver('Article', 'author', ) ); ``` -Now you can make a sample article (as a user) and if you now go over to your graphql explorer and run the following query : +Now you can make a sample article (as a user) and if you now go over to your graphql explorer and run the following query : ``` { @@ -54,9 +54,9 @@ Now you can make a sample article (as a user) and if you now go over to your gra author } } -``` +``` -You should get a response in the same format e.g. : +You should get a response in the same format e.g. : ```json { @@ -68,11 +68,11 @@ You should get a response in the same format e.g. : } } } -``` +``` ### Resolver builder -You need to initalize the `ResolverBuilder` once inside the `registerResolvers` method (or `getResolverRegistry` if you do not want to use schema extensions) in order to start registering resolvers. This is what will give you access to all the data producers by calling the `produce` method which takes as a parameter the data producer id. +You need to initialize the `ResolverBuilder` once inside the `registerResolvers` method (or `getResolverRegistry` if you do not want to use schema extensions) in order to start registering resolvers. This is what will give you access to all the data producers by calling the `produce` method which takes as a parameter the data producer id. Essentially calling the `produce` method with the data producer id is what you need to do every time you want to make a field available in the schema. We tell Drupal where and how to get the data and specify where this maps to. diff --git a/doc/producers/composing.md b/doc/producers/composing.md index 457bf4c4f..0e2b68690 100644 --- a/doc/producers/composing.md +++ b/doc/producers/composing.md @@ -26,7 +26,7 @@ $registry->addFieldResolver('Query', 'currentUser', $builder->compose( ->map('type', $builder->fromValue('user')) ->map('id', $builder->fromParent()), $builder->callback(function ($entity) { - // Here we can do anything we want to the data. We get as a parameter anyting that was returned + // Here we can do anything we want to the data. We get as a parameter anything that was returned // in the previous step. }) )); diff --git a/doc/producers/custom.md b/doc/producers/custom.md index 6f027b307..459b772c4 100644 --- a/doc/producers/custom.md +++ b/doc/producers/custom.md @@ -26,7 +26,7 @@ Now that we have this we need to make a resolver that actually loads this user, ```php logger->warning( - "Could not get missing resolvers for @server_name as its registry class (@klass) does not implement getFieldResolverWithInheritance.", + "Could not get missing resolvers for @server_name as its registry class (@class) does not implement getFieldResolverWithInheritance.", [ '@server_name' => $server->id(), - '@klass' => get_class($resolver_registry), + '@class' => get_class($resolver_registry), ] ); return []; @@ -130,10 +130,10 @@ public function getOrphanedResolvers(ServerInterface $server, array $ignore_type if (!method_exists($resolver_registry, "getAllFieldResolvers")) { $this->logger->warning( - "Could not get orphaned resolvers for @server_name as its registry class (@klass) does not implement getAllFieldResolvers.", + "Could not get orphaned resolvers for @server_name as its registry class (@class) does not implement getAllFieldResolvers.", [ '@server_name' => $server->id(), - '@klass' => get_class($resolver_registry), + '@class' => get_class($resolver_registry), ] ); return []; diff --git a/src/Plugin/DataProducerPluginCachingInterface.php b/src/Plugin/DataProducerPluginCachingInterface.php index 9fff68412..c8dd8a906 100644 --- a/src/Plugin/DataProducerPluginCachingInterface.php +++ b/src/Plugin/DataProducerPluginCachingInterface.php @@ -3,7 +3,7 @@ namespace Drupal\graphql\Plugin; /** - * Defines cachable data producer plugins. + * Defines a cacheable data producer plugins. */ interface DataProducerPluginCachingInterface extends DataProducerPluginInterface { diff --git a/src/Plugin/GraphQL/DataProducer/String/Uppercase.php b/src/Plugin/GraphQL/DataProducer/String/Uppercase.php index 5229b4746..8abaf9407 100644 --- a/src/Plugin/GraphQL/DataProducer/String/Uppercase.php +++ b/src/Plugin/GraphQL/DataProducer/String/Uppercase.php @@ -12,7 +12,7 @@ * name = @Translation("Uppercase"), * description = @Translation("Transforms a string to uppercase."), * produces = @ContextDefinition("string", - * label = @Translation("Uppercased string") + * label = @Translation("Uppercase converted string") * ), * consumes = { * "string" = @ContextDefinition("string", diff --git a/src/Plugin/GraphQL/DataProducer/Taxonomy/TaxonomyLoadTree.php b/src/Plugin/GraphQL/DataProducer/Taxonomy/TaxonomyLoadTree.php index 699abbc3a..3f2229fd7 100644 --- a/src/Plugin/GraphQL/DataProducer/Taxonomy/TaxonomyLoadTree.php +++ b/src/Plugin/GraphQL/DataProducer/Taxonomy/TaxonomyLoadTree.php @@ -126,7 +126,7 @@ public function __construct( * Resolves the taxonomy tree for given vocabulary. * * @param string $vid - * The vocanulary ID. + * The vocabulary ID. * @param int $parent * The ID of the parent's term to load the tree for. * @param int|null $max_depth diff --git a/tests/modules/graphql_alterable_schema_test/graphql_alterable_schema_test.info.yml b/tests/modules/graphql_alterable_schema_test/graphql_alterable_schema_test.info.yml index 71aba51f4..439f6f637 100644 --- a/tests/modules/graphql_alterable_schema_test/graphql_alterable_schema_test.info.yml +++ b/tests/modules/graphql_alterable_schema_test/graphql_alterable_schema_test.info.yml @@ -1,5 +1,5 @@ type: module name: GraphQL Alterable Schema Test -description: Tests if alterting schema is working. +description: Tests if altering the schema is working. package: Testing hidden: TRUE diff --git a/tests/src/Kernel/DataProducer/EntityReferenceTest.php b/tests/src/Kernel/DataProducer/EntityReferenceTest.php index 976ce0e14..982fc1733 100644 --- a/tests/src/Kernel/DataProducer/EntityReferenceTest.php +++ b/tests/src/Kernel/DataProducer/EntityReferenceTest.php @@ -48,7 +48,7 @@ public function setUp(): void { ]); $content_type2->save(); - $this->createEntityReferenceField('node', 'test1', 'field_test1_to_test2', 'test1 lable', 'node', 'default', [], FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); + $this->createEntityReferenceField('node', 'test1', 'field_test1_to_test2', 'test1 label', 'node', 'default', [], FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); $this->referencedNode = Node::create([ 'title' => 'Dolor2', diff --git a/tests/src/Kernel/DataProducer/EntityTest.php b/tests/src/Kernel/DataProducer/EntityTest.php index bfe1f94bf..4bcc11309 100644 --- a/tests/src/Kernel/DataProducer/EntityTest.php +++ b/tests/src/Kernel/DataProducer/EntityTest.php @@ -87,6 +87,7 @@ public function setUp(): void { ]); $content_type->save(); + // cspell:ignore otherbundle $content_type = NodeType::create([ 'type' => 'otherbundle', 'name' => 'otherbundle', diff --git a/tests/src/Kernel/DataProducer/RoutingTest.php b/tests/src/Kernel/DataProducer/RoutingTest.php index 7c4e6ea66..e94bf36b6 100644 --- a/tests/src/Kernel/DataProducer/RoutingTest.php +++ b/tests/src/Kernel/DataProducer/RoutingTest.php @@ -139,6 +139,7 @@ public function testUrlPath(): void { */ public function testUrlNotFound(): void { $result = $this->executeDataProducer('route_load', [ + // cspell:ignore idontexist 'path' => '/idontexist', ]); diff --git a/tests/src/Kernel/Framework/PersistedQueriesTest.php b/tests/src/Kernel/Framework/PersistedQueriesTest.php index 7958d7f0c..54703ecf6 100644 --- a/tests/src/Kernel/Framework/PersistedQueriesTest.php +++ b/tests/src/Kernel/Framework/PersistedQueriesTest.php @@ -43,6 +43,7 @@ protected function setUp(): void { $this->mockResolver('Query', 'field_two', 'this is the field two'); $this->mockResolver('Query', 'field_three', []); $this->mockResolver('Link', 'url', 'https://www.ecosia.org'); + // cspell:ignore Ecosia $this->mockResolver('Link', 'title', 'Ecosia'); } diff --git a/tests/src/Kernel/Framework/TestFrameworkTest.php b/tests/src/Kernel/Framework/TestFrameworkTest.php index 51802d268..fb9802945 100644 --- a/tests/src/Kernel/Framework/TestFrameworkTest.php +++ b/tests/src/Kernel/Framework/TestFrameworkTest.php @@ -63,6 +63,7 @@ public function testFieldMock(): void { * Test result error assertions. */ public function testErrorAssertion(): void { + // cspell:ignore wrongname $schema = <<