★ wanayoo — archive 1999 https://github.com/fsprojects/FSharp.Data.GraphQL/issues/302Nouvelle recherche | Portail wanayoo
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

The type 'Schema<Root>' does not define the field, constructor or member 'AsyncExecute' #302

Open
mjarosie opened this issue Oct 20, 2020 · 0 comments

Comments

@mjarosie
Copy link
Contributor

@mjarosie mjarosie commented Oct 20, 2020

Description

The example code shown in the Quick start section in the home page doesn't compile, showing the following error:

The type 'Schema<Root>' does not define the field, constructor or member 'AsyncExecute'

Repro steps

Code, exactly as in the quick start section:

type Person = { FirstName: string; LastName: string }
let people = [ 
    { FirstName = "Jane"; LastName = "Milton" }
    { FirstName = "Travis"; LastName = "Smith" } ]

open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Types

// GraphQL type definition for Person type
let Person = Define.Object("Person", [
    Define.Field("firstName", String, fun ctx p -> p.FirstName)
    Define.Field("lastName", String, fun ctx p -> p.LastName)  
])

// each schema must define so-called root query
let QueryRoot = Define.Object("Query", [
    Define.Field("people", ListOf Person, fun ctx () -> people)
])

// then initialize everything as part of schema
let schema = Schema(QueryRoot)

open FSharp.Data.GraphQL.Execution
let query = """
    query Example {
        people {
            firstName
        }
    }
    """
async {
    let! response = schema.AsyncExecute(query) // Here's the error.
    printf "%A" response
}

Expected behavior

Code example is fixed and works out of the box.

Actual behavior

The following error occurs:

The type 'Schema<Root>' does not define the field, constructor or member 'AsyncExecute'

Related information

FSharp.Data.GraphQL.Server: v1.0.5

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.