Skip to content

Commit

Permalink
Merge pull request #88 from moufmouf/schemafactory_addparametermapper
Browse files Browse the repository at this point in the history
Adding missing addParameterMapper method in SchemaFactory
  • Loading branch information
moufmouf committed Jun 26, 2019
2 parents 8960f6e + a577335 commit 70766cc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/laravel-package.md
Expand Up @@ -57,10 +57,12 @@ which is used internally by GraphQLite.

GraphQLite does not include additional GraphQL tooling, such as the GraphiQL editor.
To integrate a web UI to query your GraphQL endpoint with your Laravel installation,
we recommend installing GraphQL Playground
we recommend installing [GraphQL Playground](https://github.com/mll-lab/laravel-graphql-playground)

```console
$ composer require mll-lab/laravel-graphql-playground
```

By default, the playground will be available at `/graphql-playground`.

You can also use any external client with GraphQLite, make sure to point it to the URL defined in the config (`'/graphql'` by default).
4 changes: 4 additions & 0 deletions docs/other_frameworks.md
Expand Up @@ -60,6 +60,10 @@ $factory->addTypeMapper($typeMapper);
// Add a custom type mapper using a factory to create it.
// Type mapper factories are useful if you need to inject the "recursive type mapper" into your type mapper constructor.
$factory->addTypeMapperFactory($typeMapperFactory);
// Add a root type mapper.
$factory->addRootTypeMapper($rootTypeMapper);
// Add a parameter mapper.
$factory->addParameterMapper($parameterMapper);
// Add custom options to the Webonyx underlying Schema.
$factory->setSchemaConfig($schemaConfig);
// Configures the time-to-live for the GraphQLite cache. Defaults to 2 seconds in dev mode.
Expand Down
10 changes: 10 additions & 0 deletions src/SchemaFactory.php
Expand Up @@ -143,6 +143,16 @@ public function addTypeMapperFactory(TypeMapperFactoryInterface $typeMapperFacto
return $this;
}

/**
* Registers a parameter mapper.
*/
public function addParameterMapper(ParameterMapperInterface $parameterMapper): self
{
$this->parameterMappers[] = $parameterMapper;

return $this;
}

public function setDoctrineAnnotationReader(Reader $annotationReader): self
{
$this->doctrineAnnotationReader = $annotationReader;
Expand Down
3 changes: 3 additions & 0 deletions tests/SchemaFactoryTest.php
Expand Up @@ -10,6 +10,8 @@
use TheCodingMachine\GraphQLite\Containers\BasicAutoWiringContainer;
use TheCodingMachine\GraphQLite\Containers\EmptyContainer;
use TheCodingMachine\GraphQLite\Mappers\CompositeTypeMapper;
use TheCodingMachine\GraphQLite\Mappers\Parameters\CompositeParameterMapper;
use TheCodingMachine\GraphQLite\Mappers\Parameters\ContainerParameterMapper;
use TheCodingMachine\GraphQLite\Mappers\Parameters\TypeMapper;
use TheCodingMachine\GraphQLite\Mappers\RecursiveTypeMapperInterface;
use TheCodingMachine\GraphQLite\Mappers\Root\CompositeRootTypeMapper;
Expand Down Expand Up @@ -62,6 +64,7 @@ public function create(RecursiveTypeMapperInterface $recursiveTypeMapper): TypeM
}
})
->addRootTypeMapper(new CompositeRootTypeMapper([]))
->addParameterMapper(new CompositeParameterMapper([]))
->setSchemaConfig(new SchemaConfig())
->devMode()
->prodMode();
Expand Down

0 comments on commit 70766cc

Please sign in to comment.