GraphQl: cant disable operations with yaml
See original GitHub issueHi iam using api/platform 3.0.7 and i want to modify graphql operations with yaml.
My yaml looks like this:
REST: i want only GET method GRAPHQL: i want enable only Query and Create mutation
Namespace\To\Entity:
operations:
ApiPlatform\Metadata\GetCollection: ~
ApiPlatform\Metadata\Get: ~
graphQlOperations:
ApiPlatform\Metadata\GraphQl\Query: ~
ApiPlatform\Metadata\GraphQl\Mutation:
name: create
with REST (“operation” namespace) it works fine and i can see only GET methods. But with graphql i still can do collenctionQuery and all other mutations.
What am i doing wrong?
Thx for answer
Issue Analytics
- State:
- Created 9 months ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Why You Should Disable GraphQL Introspection In Production
In this post, we'll discuss why we believe you should disable GraphQL introspection in production, how to do it, and present a way...
Read more >GraphQL Best Practices
While there's nothing that prevents a GraphQL service from being versioned just like any other REST API, GraphQL takes a strong opinion on...
Read more >ESLint parser, plugin and set rules for GraphQL (for schema ...
ESLint parser, plugin and set rules for GraphQL (for schema and operations). Easily customizable with custom rules. Integrates with IDEs and modern GraphQL...
Read more >API (GraphQL) - Client code generation - AWS Amplify Docs
yml file in the root folder of your project. When generating types, codegen uses GraphQL statements as input. It will generate only the...
Read more >GraphQL Content API - Contentful
To prevent this error, make sure the field IDs you're using on each content type cannot result in the same GraphQL field name....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have the same problem, after some research and debugging, I could find two issue related to this.
ApiPlatform\Metadata\Extractor\YamlResourceExtractor
=>buildGraphQlOperations
If collection is the first query in queries array, it will override all other queries as collection. I can see loop value overwritten in line 310 and 315 which are causing this problem.ApiPlatform\Metadata\Resource\Factory\ExtractorResourceMetadataCollectionFactory
=>addGraphQlOperations
attribute class is not filled, functionaddOperations
has thisgetOperationWithDefaults
which fixes name and other attributes, but is missing for graphql, this is why you have to specify class attribute in yaml directly.my working yaml:
Also you can just send only array without operation class
@durimjusaj
Thank you, this works fine.
It would be nice to update documentation in next hotfix.