ablestack / graphql-codegen-hasura Goto Github PK
View Code? Open in Web Editor NEWcode-generator plugins for hasura/apollo-gql/typescript development
License: MIT License
code-generator plugins for hasura/apollo-gql/typescript development
License: MIT License
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.
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
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?
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?
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
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
}
}
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...
?
Just a suggestion to add RenovateBot to track new versions of the codegen more easily and keep up to date with it.
If you'll add tests we can even think about connecting this repo to the codegen's Connected Build
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?
Hi @ahrnee. Just wondering if there's any way to communicate and give feedback. Do you check Issues? Is there a better way?
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?
Hi. This looks very promising! Thank for putting it out there.
I ran into a couple issues with the demo....
Please verify that the package.json has a valid "main" entry
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!
Just a suggestion, maybe not all the people want to use Apollo Client Fetcher, so a custom fetcher is a must to have!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.