Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GraphQL] Only exposes the mutations if any #2181

Merged
merged 1 commit into from
Sep 11, 2018

Conversation

sroze
Copy link
Contributor

@sroze sroze commented Aug 28, 2018

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets ø
License MIT
Doc PR ø

Otherwise, GraphiQL gives this lovely message:

Mutation fields must be an object with field names as keys or a function which returns [...]

@sroze sroze force-pushed the only-exposes-the-mutations-if-any branch from caa7a35 to 152b643 Compare August 28, 2018 17:49
'mutation' => new ObjectType([
];

if (\count($mutationFields) > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ($mutationFields)?

Copy link
Member

@dunglas dunglas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should target 2.3 as it's a bug fix.

@alanpoulain
Copy link
Member

Maybe you could add a unit test or a Behat one (by using introspection)?

@sroze sroze force-pushed the only-exposes-the-mutations-if-any branch from 152b643 to 93c24ee Compare August 29, 2018 16:58
@sroze sroze changed the base branch from master to 2.3 August 29, 2018 16:58
@sroze
Copy link
Contributor Author

sroze commented Aug 29, 2018

Rebased and changed check with a simple if.

@alanpoulain based on the complexity of the SchemaBuilderTest, I don't think it's worth it. Also, I'll follow up with a fair amount of pull-requests regarding the messenger integration in the next few weeks that should cover this use-case :)

@dunglas dunglas merged commit a74b570 into api-platform:2.3 Sep 11, 2018
@dunglas
Copy link
Member

dunglas commented Sep 11, 2018

Thanks @sroze

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants