Giter VIP home page Giter VIP logo

graphql-codegen-hasura's People

Contributors

dependabot[bot] avatar jamshally avatar mwarger avatar zeppelinnn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql-codegen-hasura's Issues

Using apollo vscode plugin shows error

The apollo vscode plugin crashes because there is more than one version of every graphql document created when generating code.

Error initializing Apollo GraphQL project "graphql": Error: ️️There are multiple definitions for the queryTodoById operation. Please rename or remove all operations with the duplicated name before continuing.

I believe this is due to the index.ts file being generated by the hasura plugin, and then the typescript code generators picking up this file and generating their respective documents from it.

I'm not sure if it was intended to be used with the vscode plugin, but I think it would be a great help if the actual name was not duplicated.

vulnerabilities in demo

In a example "demo" folder project has allot outdated dependencies

found 10544 vulnerabilities (10537 low, 7 high)

To fix this run

npm audit fix --force

Unable to find template plugin matching graphql-codegen-hasura-gql

No mater what I did - tried reinstalling and so on. I'm still getting errors like:

Unable to find template plugin matching graphql-codegen-hasura-typescript
Unable to find template plugin matching graphql-codegen-hasura-react
Unable to find template plugin matching graphql-codegen-hasura-client-config

Is this some kind of dependency naming issue?

image

Suggestion: Make it React independent!

Apollo Client ties it up to strictly use under React! What about NextJs API? That's personally my case when a receive a certain webhook at a certain endpoint and then have to request a little bit more information before put all together to save it into the database. Currently using a fetch API to do it is not ideal there are other options like graphql-request! But you seem to support neither of them?

Problem where there's not id field

By trying to use your package in our project, I've spotted that the generation fails when tables doesn't have an id field.

Here's the error I get

    TypeError: Cannot read property 'name' of undefined
        at Object.exports.ID_FIELD_TEST (/Users/pac/dev/metagame/TheGame/node_modules/graphql-codegen
-hasura-shared/utils.js:8:14)
        at Object.getIdPostGresFieldType (/Users/pac/dev/metagame/TheGame/node_modules/graphql-codege
n-hasura-shared/utils.js:59:20)
        at makeFetchObjectsGQL (/Users/pac/dev/metagame/TheGame/node_modules/graphql-codegen-hasura-s
hared/gqlInjectors.js:84:46)
        at Object.injectFetchAsQueryGql (/Users/pac/dev/metagame/TheGame/node_modules/graphql-codegen
-hasura-shared/gqlInjectors.js:39:7)
        at injectEntityFetchAsQueryGql (/Users/pac/dev/metagame/TheGame/node_modules/graphql-codegen-
hasura-gql/index.js:52:37)
        at /Users/pac/dev/metagame/TheGame/node_modules/graphql-codegen-hasura-gql/index.js:23:31

Here's our project&settings
https://github.com/MetaFam/TheGame/blob/codegen/packages/graphql-codegen/graphql-codegen-gql.yaml

How to make aggregate query

Does the plugin generate the "aggregate" query

I have a query to fetch the "project" list with the pagination(offset and limit) and also want to get the total number of the list by (projects_aggregate)

query ExploreProjects(
  $name: String
  $offset: Int
  $limit: Int
) {
  projects_aggregate(
    where: {
      ...
    }
  ) {
    aggregate {
      count
    }
  }
  projects(
    limit: $limit
    offset: $offset
    order_by: { updated_at: desc }
    where: {
      ...
    }
  ) {
    ...Project
  }
}

Typescript error with ts generated file for cacheWrite methods

return apolloCache.writeQuery<${fragmentNamePascalCase}Fragment | null>({ query: ${queryByIdName}Document, variables: { ${entityShortCamelCaseName}Id }, data: (${fragmentNameCamelCase} ? ${fragmentNameCamelCase}Partial : null), broadcast:apolloBroadcast });

image

Running @apollo/client version 3.1.4.

Looks like the types were updated here: apollographql/apollo-client@7202b78#diff-a425d86f9a8376d3071667e3198c940a

The solution here would be to not return the result of apolloCache.writeQuery... ?

[Question] Where to get ApolloProvider

import { ApolloProvider } from '@apollo/react-hooks';
import { ApolloProvider } from '@apollo/react-components';

But it says:

Please note that as of version 4.0.0 you should prefer to import React hooks and testing utilities from @apollo/client

So where should I get ApolloProvider from?

Are you here?

Hi @ahrnee. Just wondering if there's any way to communicate and give feedback. Do you check Issues? Is there a better way?

Allow-list in production

Enabling the allow-list is highly recommended when running the GraphQL engine in production.

I wonder how do you handle this when making use of the generated generic queries?

Help getting demo set up.

Hi. This looks very promising! Thank for putting it out there.

I ran into a couple issues with the demo....

  1. package.json in the Demo project has Typescript defined in dependencies and devDependencies. I think it only needs to be in dev.
  2. Problem generating - Please verify that the package.json has a valid "main" entry
    image

I've never used a workspace structure like you have set up so I'm not sure exactly how to fix this.

Thanks for any help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.