Comments (6)
My relay mutation config looks like that:
saveProject:
builder: 'Mutation'
builderConfig:
name: 'SaveProject'
saveWorkflow:
builder: 'Mutation'
builderConfig:
name: 'SaveWorkflow'
With this You would only have to write this:
saveProject:
type: 'Mutation'
name: 'SaveProject'
saveWorkflow:
type: 'Mutation'
name: 'SaveWorkflow'
The implementation is domain specific though. I did not force it to be super generic. Still, you might want to use the idea to somehow make a generic solution out of it. If you want I can post you some code. But it also includes mapping arguments to DTOs (data transfer objects) which are automatically validated when you attach constraints on them (annotation). It also include some generic resolver that then redirects to a specific mutations handler.
Basically: following relay convention, you only need
- a name for the mutation and
- a field name
Out of this information you can imply the requirement for a 'SaveWorkflowInput' and 'SaveWorkflowPayload' type. You can define them as types separately. You have to, because that is the app specific part a generic solution can not imply for you.
from graphqlbundle.
Using graphql
syntax would be better.
from graphqlbundle.
The GraphQL Relay Mutation js implementation look like returning a simple Field definition. So why not directly use Mutation Field builder with some config?
Mutation:
type: object
config:
fields:
introduceShip:
builder: Mutation
builderConfig:
inputFields: # Define the input
shipName: {type: String!}
factionId: {type: ID!}
outputFields: # Define the payload
ship: {type: Ship}
faction: {type: Faction}
mutateAndGetPayload: "@=mutation('my_mutator', [value])"
from graphqlbundle.
I don't like what you're proposing. If Mutation
has a lot of mutation fields, then it's not possible to split then into multiple files.
from graphqlbundle.
OK I understand the need. That also mean that we can now define custom field definition separated from system types, so it become reusable. We can generalize this to all field builder...
from graphqlbundle.
Yes. With the new feature recently added! :)
from graphqlbundle.
Related Issues (20)
- Add support for `parseValue` configuration for `input-object` types
- Dynamic fields from database HOT 1
- Default enum value for argument when using annotations HOT 3
- MetadataParser will throw exception if you have Symfony PHP Configurations in your bundle HOT 4
- Types with same name differents according to schema
- Example from doc not working under Symfony 6 HOT 1
- The path "overblog_graphql_types.RootQuery._object_config.fields" should have at least 1 element(s) defined. HOT 10
- Ignoring of the name parameter of field attribute HOT 3
- Dataloader or Resolver Contexts & Parameters
- Type error introduced in 1.2.0 HOT 23
- Multiline documentation with a graphql schema leads to unnececairy indent/code block formatting HOT 1
- Multi level Input-object validation issue HOT 1
- Automatic type resolver for annotations/attributes
- ArgumentTransfomer should only validate arguments of type input
- Default field value for Input Object
- Annotations should be deprecated HOT 3
- Arguments order shouldn't matter
- Add ability to set HTTP status code and set own headers
- Help: Unclear how to use validation "link" with mutation/input objects HOT 2
- Validation is called on optional fields that are not passed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphqlbundle.