Graphqlbundle: Question: Mutation with GraphQL schema language

Created on 14 May 2018  路  10Comments  路  Source: overblog/GraphQLBundle

| Q | A
| ---------------- | -----
| Bug report? | no
| Feature request? | no
| BC Break report? | no
| RFC? | no
| Version/Branch | 0.11

How do I use the mutation with GraphQL schema language because I get an error "Operation definition is not supported right now". when I defined *.graphql:

type Language {
    code: ID!
    name: String!
    createdAt: DateTime!
    updatedAt: DateTime!
}

input NewLanguage {
    code: ID!
    name: String!
}

mutation CreateNewLanguage($newLanguage: NewLanguage!) {
    newLanguage(language: $newLanguage) {
        code
        name
    }
}
documentation needed question

Most helpful comment

Okay thanks, that was just a question for the documentation.

Well, we can't wait to migrate our ~70 types, ~70 input objects and ~85 mutations from .yml to .graphql files (cc @tristanbes) 馃ぃ

All 10 comments

Hi this part
mutation

CreateNewLanguage($newLanguage: NewLanguage!) {
    newLanguage(language: $newLanguage) {
        code
        name
    }
}

Is a query not a type definition. You should define your query and mutation as type then provide their names with bundle configuration.

Could you show me how to do it for this example, because I don't really know how to do it?
I try:

type Query {
    newLanguage: Language!
}
type Mutation {
    CreateNewLanguage: Language!
}
type Language {
    code: ID!
    name: String!
    createdAt: DateTime!
    updatedAt: DateTime!
}

input NewLanguage {
    code: ID!
    name: String!
}

type RootMutation {
    CreateNewLanguage(newLanguage: NewLanguage!): Language!
}

type RootQuery {
  language: Language!
}
overblog_graphql:
    definitions:
      schema:
        query: RootQuery
        mutation: RootMutation

After you should define ResolverMap

Thank you very much, earlier I misinterpreted your answer and in the meantime I came up with it myself, although it seems to me that an example would be useful in the documentation for the version based on GraphQL schema language.

Yeah, it seems it missing a complet example, feel free to contribute anyway, if you see how this can be improve :+1:

Instead of making a new issue, I place my piece of junk here.

Couldn't be possible to add a bit more infos in all code samples, or have a dummy project somewhere?
I mean, a simple line comment with the file name. As simple as that.

(Giving, or setting up through the recipe, a default directory structure would also be a nice point)

We working on a demo but documentation take a lot of time. The more feedback we have the easier the doc improvement will be.

I will try to work on some documentation improvments for this page GraphQL schema language.

By the way @mcg-web, when we define our schema with GraphQL, it is not possible to:

  • define field access control
  • define field public control
  • work with fields inheritance?

right?

Yes acl management is missing, must implement it yourself right now, while waiting for 0.12...

Okay thanks, that was just a question for the documentation.

Well, we can't wait to migrate our ~70 types, ~70 input objects and ~85 mutations from .yml to .graphql files (cc @tristanbes) 馃ぃ

Was this page helpful?
0 / 5 - 0 ratings