Graphqlbundle: Trying to install GraphQLBundle, error in doc section (HTML content inside)

Created on 7 Apr 2017  路  9Comments  路  Source: overblog/GraphQLBundle

Hi :-),

I am trying to install this bundle following the instructions but when I go to localhost/graphiql in doc section I get html document from localhost/. Sorry if its a dumb question :/ but I am a newbie with graphQL

Error IMG

My current sf version: 3.2.7

# app/config/graphql/Query.types.yml
Query:
    type: object
    config:
        description: "A humanoid creature in the Star Wars universe."
        fields:
            user:
                type: "User"
                resolve: "@=resolver('myresolver')"
# app/config/graphql/User.types.yml
User:
    type: object
    config:
        description: "User"
        fields:
            id:
                type: "String!"
            name:
                type: "String"
# app/config/services.yml

services:

    myresolver:
        class: AppBundle\Service\MyResolver
        tags:
            - { name: overblog_graphql.resolver, alias: myresolver, method: resolveMyResolver }
# src/AppBundle/Service/MyResolver.php

namespace AppBundle\Service;

class MyResolver
{
    public function resolveMyResolver()
    {
        return ['id' => 1, 'name' => 'Luke'];
    }
}
question

All 9 comments

Hi,

Here the error:

services:  
  myresolver:
        class: AppBundle\Service\MyResolver
        arguments: ['@overblog_graphql.promise_adapter']
        tags:
            - { name: form.type, alias: myresolver, method: resolveMyResolver }

wrong tag name, replace form.type by overblog_graphql.resolver

sorry I posted a wrong file... I tested before with overblog_graphql.resolver but I got the same error :/

I don't know why in doc section get html. To get doc details its called via ajax?, but executing console debug:router only get this new urls

  overblog_graphql_endpoint                  ANY      ANY      ANY    /                                  
  overblog_graphql_batch_endpoint            ANY      ANY      ANY    /batch                             
  overblog_graphql_multiple_endpoint         ANY      ANY      ANY    /graphql/{schemaName}              
  overblog_graphql_batch_multiple_endpoint   ANY      ANY      ANY    /graphql/{schemaName}/batch        
  overblog_graphql_graphiql                  ANY      ANY      ANY    /graphiql                          
  overblog_graphql_graphiql_multiple         ANY      ANY      ANY    /graphiql/{schemaName} 

Can you give me the html content please?

Its all html from home ("DefaultController" it's a fresh symfony installation)

I tried your configuration an it work fine for me. You should try removing default controller router.

Thx for your hel mcg-web I create a repo to simulare the error

https://github.com/MGDSoft/OverGraphQLExample

Nice i get the error, here is the fix

the bundle doesn't supports the schema defined in app so i move it in AppBundle.

aaa thx for your help!

Was this page helpful?
0 / 5 - 0 ratings