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

Scaffolding tool does not generate proper query input argument types #156

Open
preetb123 opened this issue Dec 10, 2019 · 0 comments
Open
Labels
help wanted Extra attention is needed

Comments

@preetb123
Copy link

preetb123 commented Dec 10, 2019

Scaffolding tool(yarn mst-gql) does not generate proper types for input variables
Ex. the generated types for code
https://github.com/preetb123/mst-gql-app/blob/master/server/index.js#L79

type Query {
    books: [Book]
    filterBooks(ids: [BookInfo]): [Book]
}
input BookInfo {
    id: String
    title: String
}

are
https://github.com/preetb123/mst-gql-app/blob/master/src/models/RootStore.base.ts#L36

queryFilterBooks(variables: { ids: BookInfo | undefined[] }, resultSelector: string | ((qb: BookModelSelector) => BookModelSelector) = bookModelPrimitives.toString(), options: QueryOptions = {}) {
      return self.query<{ filterBooks: BookModelType[]}>(`query filterBooks($ids: [BookInfo]) { filterBooks(ids: $ids) {
        ${typeof resultSelector === "function" ? resultSelector(new BookModelSelector()).toString() : resultSelector}
      } }`, variables, options)

Here the variable ids should accept [BookInfo]

It works properly for primitive data types inputs. i.e if ids were to accept [String], it would generate proper type in the query as queryFilterBooks(variables: { ids: string[] }

@chrisdrackett chrisdrackett added the help wanted Extra attention is needed label Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants