Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
d7cbb60
Init 0.12-dev
Mar 13, 2018
b25b5e2
Fix version requirements
Mar 13, 2018
a2cacad
Add a NAME constant in generated type classes
arnaud-lb Mar 22, 2018
4465366
Merge pull request #302 from arnaud-lb/generated-type-name-constant
mcg-web Mar 22, 2018
6fec004
Dump schema: Adds option to export schema with descriptions
adri Apr 9, 2018
67656e5
Merge pull request #310 from adri/feature/dump-schema-including-descr…
mcg-web Apr 9, 2018
50f6b06
Update custom exception mapping doc
maximecolin Apr 10, 2018
0491915
fix #311 custom exception mapping doc
mcg-web Apr 10, 2018
b18e0b7
Fix minor typo in documentation
Apr 15, 2018
eaa79fe
Merge branch 'master' into patch-1
Apr 15, 2018
249968a
Fix #314 minor typo in documentation
mcg-web Apr 15, 2018
60eec0c
Enum type
sylfabre Apr 17, 2018
9e8fdb9
Update enum.md
sylfabre Apr 17, 2018
2d8393a
resolver.md
sylfabre Apr 19, 2018
c977abd
resolver.md
sylfabre Apr 19, 2018
b1e3f81
resolver.md
sylfabre Apr 19, 2018
cf4697c
relay-paginator.md
sylfabre Apr 19, 2018
9b48a77
Change graphql format
god1dog Apr 20, 2018
e77096e
Merge pull request #317 from god1dog/master
mcg-web Apr 20, 2018
b53d7b6
Merge pull request #315 from sylfabre/master
mcg-web Apr 23, 2018
47f54b1
Fixed typos and changed the wording slightly.
strayobject Apr 25, 2018
c306fdb
Fixed #320 documentation typos and changed the wording slightly.
mcg-web Apr 25, 2018
3ca2b71
User Deprecated: Referencing controllers with a single colon is depre…
xkobal May 9, 2018
4c89617
Merge branch '0.11'
May 9, 2018
b3658c9
Merge branch 'master' into master
mcg-web May 9, 2018
0972d9a
Improve documentation (#327) Object access control
sylfabre May 11, 2018
843a9d7
Update graphql.yml
xkobal May 14, 2018
ede385d
Update services.yml
xkobal May 14, 2018
8654227
Merge pull request #325 from xkobal/master
mcg-web May 14, 2018
2a74fd6
Add a slide
mcg-web May 22, 2018
ed16cb6
Example with a PHP constant
sylfabre May 23, 2018
3d795de
Improve documentation #330
mcg-web May 23, 2018
03b41ee
Example with a PHP constant
sylfabre May 23, 2018
519a645
Merge branch '0.11'
May 28, 2018
9f15ec7
Fix travis build
May 28, 2018
1ed56da
Fix composer minimum stability
May 28, 2018
3ce5878
Fix examples indentation
mcg-web May 29, 2018
2729826
Update InheritanceProcessor.php
sylfabre May 31, 2018
315137e
Update InheritanceProcessorTest.php
sylfabre May 31, 2018
921329d
Improve #338 exception message
mcg-web May 31, 2018
8d19ff5
Merge branch '0.11'
May 31, 2018
817661c
Merge branch '0.11'
May 31, 2018
3102ea7
Remove useless import
Jun 3, 2018
c011b3f
doc(graphql-schema-language): rewrite and add section for mutations
Kocal Jun 3, 2018
87565f9
Merge pull request #340 from Kocal/doc/improve-graphql-schema-languag…
mcg-web Jun 3, 2018
9109b9d
Merge branch '0.11'
Jun 5, 2018
d9c457d
typo
sylfabre Jun 10, 2018
ef5ff38
Merge pull request #343 from sylfabre/patch-3
mcg-web Jun 10, 2018
eb26048
Merge branch '0.11'
Jun 12, 2018
f022e8e
doc(type-inheritance): added an usage example for decorators
akomm Jun 19, 2018
fc0c38c
Merge pull request #351 from akomm/master
mcg-web Jun 19, 2018
4d43f22
Merge branch '0.11'
Jul 12, 2018
4b77ed6
Merge branch '0.11'
Jul 13, 2018
f6a7fb4
Merge branch '0.11'
Jul 17, 2018
7d25f77
Merge branch '0.11'
Jul 18, 2018
897627a
docs: improve mutation example
Kocal Jul 26, 2018
6344b71
docs(mutation): add link to relay
Kocal Jul 26, 2018
861825e
Merge pull request #359 from Kocal/docs/improve-mutation
mcg-web Jul 28, 2018
4090a25
Merge branch '0.11'
Aug 6, 2018
1dd8332
Merge branch '0.11'
Aug 17, 2018
8b26b21
Merge branch '0.11'
Aug 19, 2018
5e3b28e
Merge branch '0.11'
Aug 19, 2018
12179f5
EOL 0.10
Aug 19, 2018
65c621b
Fix typos, improve phrasing in "Handle CORS" doc page
Inego Aug 24, 2018
8fc6851
Improve phrasing in "Object access control"
Inego Aug 24, 2018
291aa3b
Fix typos, punctuation in "Fields public control"
Inego Aug 24, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,8 @@ script: composer test

jobs:
include:
- stage: Test
php: 5.6
env: COMPOSER_UPDATE_FLAGS=--prefer-lowest SYMFONY_DEPRECATIONS_HELPER=disabled GRAPHQLPHP_VERSION=^0.11.2
- php: 5.6
env: SYMFONY_VERSION=3.1.* SYMFONY_DEPRECATIONS_HELPER=disabled GRAPHQLPHP_VERSION=0.12
- php: 7.0
env: SYMFONY_VERSION=3.2.* PHPUNIT_VERSION=^5.7.26
- php: 7.1
- php: 7.2
env: SYMFONY_VERSION=3.3.*
- php: 7.2
env: SYMFONY_VERSION=3.4.*
env: SYMFONY_VERSION=3.4.* GRAPHQLPHP_VERSION=^0.11.2
- php: 7.2
env: SYMFONY_VERSION=4.1.* STABILITY=beta
- php: nightly
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ It also supports:

Browse your version documentation:

* [0.8](https://github.com/overblog/GraphQLBundle/blob/0.8/README.md)
* [0.9](https://github.com/overblog/GraphQLBundle/blob/0.9/README.md)
* [0.10](https://github.com/overblog/GraphQLBundle/blob/0.10/README.md)
* [0.11](https://github.com/overblog/GraphQLBundle/blob/0.11/README.md)
* [0.8 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.8/README.md)
* [0.9 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.9/README.md)
* [0.10 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.10/README.md)
* [0.11 (STABLE)](https://github.com/overblog/GraphQLBundle/blob/0.11/README.md)
* [0.12 (DEV)](https://github.com/overblog/GraphQLBundle/blob/master/README.md)

[Versions requirements](docs/index.md#versions-requirements)

Documentation
-------------
Expand Down Expand Up @@ -63,6 +66,7 @@ Documentation
- [Promise](docs/data-fetching/promise.md)
- [Security](docs/security/index.md)
- [Handle CORS](docs/security/handle-cors.md)
- [Object access control](docs/security/object-access-control.md)
- [Fields access control](docs/security/fields-access-control.md)
- [Fields public control](docs/security/fields-public-control.md)
- [Limiting query depth](docs/security/limiting-query-depth.md)
Expand All @@ -74,6 +78,8 @@ Documentation
Talks and slides to help you start
----------------------------------

* GraphQL in Symfony *by Bernd Alter* - [Twitter](https://twitter.com/bazoo0815)
- [Talk about GraphQL and its implementation with Symfony (26.04.2017)](https://www.slideshare.net/berndalter7/graphql-in-symfony) `English`
* GraphQL is right in front of us, let's to it! *by Renato Mendes Figueiredo* - [Twitter](https://twitter.com/renatomefi), [GitHub](https://github.com/renatomefi)
- [Slides at http://talks.mefi.in/graphql-scotphp17](http://talks.mefi.in/graphql-scotphp17/) `English`
- [Video at SymfonyCamp UA 2017](https://www.youtube.com/watch?v=jyoYlnCPNgk) `English`
Expand Down
38 changes: 19 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
"sort-packages": true
},
"require": {
"php": ">=5.6",
"php": ">=7.1",
"overblog/graphql-php-generator": "^0.7.0",
"psr/log": "^1.0",
"symfony/config": "^3.1 || ^4.0",
"symfony/dependency-injection": "^3.1 || ^4.0",
"symfony/event-dispatcher": "^3.1 || ^4.0",
"symfony/expression-language": "^3.1 || ^4.0",
"symfony/framework-bundle": "^3.1 || ^4.0",
"symfony/options-resolver": "^3.1 || ^4.0",
"symfony/property-access": "^3.1 || ^4.0",
"symfony/config": "^3.4 || ^4.0",
"symfony/dependency-injection": "^3.4 || ^4.0",
"symfony/event-dispatcher": "^3.4 || ^4.0",
"symfony/expression-language": "^3.4 || ^4.0",
"symfony/framework-bundle": "^3.4 || ^4.0",
"symfony/options-resolver": "^3.4 || ^4.0",
"symfony/property-access": "^3.4 || ^4.0",
"webonyx/graphql-php": "^0.11.2 || ^0.12.0"
},
"suggest": {
Expand All @@ -51,20 +51,20 @@
"phpunit/phpunit": "^5.7.26 || ^6.0",
"react/promise": "^2.5",
"sensio/framework-extra-bundle": "^3.0",
"symfony/asset": "^3.1 || ^4.0",
"symfony/browser-kit": "^3.1 || ^4.0",
"symfony/console": "^3.1 || ^4.0",
"symfony/css-selector": "^3.1 || ^4.0",
"symfony/phpunit-bridge": "^3.1 || ^4.0",
"symfony/process": "^3.1 || ^4.0",
"symfony/security-bundle": "^3.1 || ^4.0",
"symfony/templating": "^3.1 || ^4.0",
"symfony/web-profiler-bundle": "^3.1 || ^4.0",
"symfony/yaml": "^3.1 || ^4.0"
"symfony/asset": "^3.4 || ^4.0",
"symfony/browser-kit": "^3.4 || ^4.0",
"symfony/console": "^3.4 || ^4.0",
"symfony/css-selector": "^3.4 || ^4.0",
"symfony/phpunit-bridge": "^3.4 || ^4.0",
"symfony/process": "^3.4 || ^4.0",
"symfony/security-bundle": "^3.4 || ^4.0",
"symfony/templating": "^3.4 || ^4.0",
"symfony/web-profiler-bundle": "^3.4 || ^4.0",
"symfony/yaml": "^3.4 || ^4.0"
},
"extra": {
"branch-alias": {
"dev-master": "0.11-dev"
"dev-master": "0.12-dev"
}
},
"scripts": {
Expand Down
14 changes: 7 additions & 7 deletions docs/definitions/expression-language.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Expression language
===================

All definitions configs entries can use expression language but it must be explicitly triggered using "@=" like prefix.
All definition config entries can use expression language but it must be explicitly triggered using "@=" like prefix.

**Functions description:**

Expand Down Expand Up @@ -43,11 +43,11 @@ Expression | Description | Scope
Custom expression function
--------------------------

Custom expression function is easy as creating a tagged service.
Adding useful expression function can help user create simple resolver without having to leave config file,
this also improve performance by removing a useless external resolver call.
Adding custom expression function is easy since all you need to do is create a tagged service.
Expression functions can help user create simple resolver without having to leave config file,
this also improves performance by removing a useless external resolver call.

Here an example to add an custom expression equivalent to php `json_decode`:
Here is an example to add a custom expression equivalent to php `json_decode`:

```php
<?php
Expand Down Expand Up @@ -77,7 +77,7 @@ App\ExpressionLanguage\JsonDecode:
tags: ['overblog_graphql.expression_function']
```

Now `json_decode` can be use in schema:
Now `json_decode` can be used in schema:

```yaml
Object:
Expand All @@ -89,5 +89,5 @@ Object:
resolve: "@=json_decode(value.json_data, true)['name']"
```

**Tips**: At last if this is till no answer to all your needs, the expression language service can be custom
**Tips**: At last if this is not an answer to all your needs, the expression language service can be customized
using bundle configuration.
113 changes: 99 additions & 14 deletions docs/definitions/graphql-schema-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,117 @@ or this [cheat sheet](https://github.com/sogko/graphql-shorthand-notation-cheat-

#### Usage

##### Define Types

> [GraphQL documentation about types and fields](https://graphql.github.io/learn/schema/#object-types-and-fields).


```graphql
# config/graphql/schema.types.graphql

type Query {
bar: Foo!
baz(id: ID!): Baz
type Character {
# Name of the character
name: String!
# This character appears in those episodes
appearsIn: [Episode]!
}
```

##### Define Enumeration types

scalar Baz
> [GraphQL documentation about Enumerations types](https://graphql.github.io/learn/schema/#enumeration-types).

interface Foo {
# Description of my is_foo field
is_foo: Boolean
```graphql
# Enumeration of episodes
enum Episode {
NEWHOPE
EMPIRE
JEDI
}
type Bar implements Foo {
is_foo: Boolean
user: User!
```

##### Define Interfaces

> [GraphQL documentation about Interfaces](https://graphql.github.io/learn/schema/#interfaces).

```graphql
interface Character {
id: ID!
name: String!
friends: [Character]
appearsIn: [Episode]!
}
```

```graphql
type Human implements Character {
id: ID!
name: String!
friends: [Character]
appearsIn: [Episode]!
starships: [Starship]
totalCredits: Int
}

enum User {
TATA
TITI
TOTO
type Droid implements Character {
id: ID!
name: String!
friends: [Character]
appearsIn: [Episode]!
primaryFunction: String
}
```

##### Define queries

> [GraphQL documentation about Query type](https://graphql.github.io/learn/schema/#the-query-and-mutation-types).

```graphql
type RootQuery {
# Access all characters
characters: [Character]!
}
```

Do not forget to configure your schema **query** type, as described in the [schema documentation](https://github.com/overblog/GraphQLBundle/blob/master/Resources/doc/definitions/schema.md).

```yml
overblog_graphql:
definitions:
schema:
query: RootQuery
```

##### Define mutations

> [GraphQL documentation about Mutation type](https://graphql.github.io/learn/schema/#the-query-and-mutation-types).

```graphql
input CreateCharacter {
name: String!
}

input UpdateCharacter {
name: String!
}

type RootMutation {
createCharacter(character: CreateCharacter!): Character!
updateCharacter(characterId: ID!, character: UpdateCharacter!): Character!
}
```

Do not forget to configure your schema **mutation** type, as described in the [schema documentation](https://github.com/overblog/GraphQLBundle/blob/master/Resources/doc/definitions/schema.md).

```yml
overblog_graphql:
definitions:
schema:
mutation: RootMutation
```

---

When using this shorthand syntax, you define your field resolvers (and some more configuration) separately
from the schema. Since the schema already describes all of the fields, arguments, and result types, the only
thing left is a collection of callable that are called to actually execute these fields.
Expand Down
54 changes: 53 additions & 1 deletion docs/definitions/mutation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Mutation

Here an example without using relay:
Here an example of mutation without using [relay](https://facebook.github.io/relay/):

```yaml
Mutation:
Expand Down Expand Up @@ -34,4 +34,56 @@ IntroduceShipInput:
type: "String!"
```

To implement the logic behind your mutation, you should create a new class that
implements `MutationInterface` and `AliasedInterface` interfaces.

```php
<?php
# src/GraphQL/Mutation/ShipMutation.php
namespace App\GraphQL\Mutation;

use Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface;
use Overblog\GraphQLBundle\Definition\Resolver\MutationInterface;

class ShipMutation implements MutationInterface, AliasedInterface
{
private $factionRepository;

public function __construct(FactionRepository $factionRepository) {
$this->factionRepository = $factionRepository;
}

public function createShip(string $shipName, int $factionId): array
{
// `$shipName` has the value of `args['input']['shipName']`
// `$factionId` has the value of `args['input']['factionId']`

// Do something with `$shipName` and `$factionId` ...
$ship = new Ship($shipName);
$faction = $this->factionRepository->find($factionId);
$faction->addShip($ship);
// ...


// Then returns our payload, it should fits `IntroduceShipPayload` type
return [
'ship' => $ship,
'faction' => $faction,
];
}

/**
* {@inheritdoc}
*/
public static function getAliases()
{
return [
// `create_ship` is the name of the mutation that you SHOULD use inside of your types definition
// `createShip` is the method that will be executed when you call `@=resolver('create_ship')`
'createShip' => 'create_ship'
];
}
}
```

Here the same example [using relay mutation](relay/mutation.md).
2 changes: 1 addition & 1 deletion docs/definitions/relay/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ User:
resolve: '@=resolver("friends", [value, args])'
friendsForward:
type: userConnection
argsBuilder: "Relay::ForwardConnection
argsBuilder: "Relay::ForwardConnection"
resolve: '@=resolver("friends", [value, args])'
friendsBackward:
type: userConnection
Expand Down
Loading