Questions tagged [graphql-codegen]
182 questions
0
votes
1 answer
How to fetch schema from graphQL API endpoint
I need to fetch a schema from graphQL API endpoint.
So the result must be a string like:
type User {
id: ID!
name: String!
}
type Home {
user: User!
address: String
country: String!
}
type Query {
MyUsers: User!
…

podeig
- 2,597
- 8
- 36
- 60
0
votes
0 answers
Calling react-query method outside the body of a function component
So, I've been searching the internet for an example of a react-query function called outside the body of the function component; however, I was unable to find a sample.
I have a query type of GraphQL, and I am waiting for a value from the form that…

Rich
- 3,928
- 4
- 37
- 66
0
votes
1 answer
How to get a type of a single resolver function?
I wondering if it possible to get a type of single resolver function generated by graphql-codegen?
I also use graphql-modules with graphql-modules-preset. All of these libraries provide me a list of automatically generated types, but unfortunately I…

Roman Mahotskyi
- 4,576
- 5
- 35
- 68
0
votes
0 answers
ApolloProvider with Hot Chocolate API returns 404 for Apollo Client
First time using Hot Chocolate and Apollo and I have an issue where the Apollo client created always returns 404 for the Hot Chocolate API. This API is running on localhost and can be queried fine.
Whats weird is, if I use the Apollo Client…

Kurtis
- 1,172
- 2
- 12
- 20
0
votes
1 answer
How to access create-react-app .env file from codegen.yml from graphql-code-generator?
So I have this codegen.yml
overwrite: true
schema:
- ${REACT_APP_GRAPHQL_URL}:
headers:
'x-hasura-admin-secret': ${REACT_APP_GRAPHQL_ADMIN_SECRET}
documents: "./src/**/*.{ts,tsx}"
generates:
src/generated/graphql.tsx:
…

Aituusi
- 123
- 2
- 8
0
votes
0 answers
GraphQL codegen generated mutation hooks
In my React application I am using graphQL code generator for generating query and mutation React hooks (I am using Apollo client). Generated queries work just fine, but when it comes to mutation I am getting this error :
message: "Error trying to…

adammartiska
- 35
- 1
- 4
0
votes
1 answer
Sending dynamic number of mutations at once
Is there a standard way to send a dynamic number of mutations in the same request with Apollo client ?
I have to deal with a Graphql API that only expose a single delete mutation, and I'd like to call it with multiple ids. Here's how it's…

Matthieu Dsprz
- 385
- 6
- 10
0
votes
1 answer
How to set up Types with Graphql Codegen
I have a Vue 3 component using Urql to query a Hasura graphql endpoint. I have managed to get the fairly simple query working, and am now trying to make the component Type safe.
I am using graphql Codegen to build the types, and it is generating a…

maxweld
- 229
- 2
- 15
0
votes
0 answers
Type inheritance leading to huge generated operation types
We're using graphql-codegen for generating types for graphql operations.
On our schema we have 50+ types that implement a common base interface Item.
Example: All types implement Item:
type Query {
datasource(value: String!): Item
}
interface…

Mark Lowe
- 1,056
- 8
- 16
0
votes
3 answers
How to specify types for nested "maybes" in generated query types?
I use Graphql codegen to generate types from our schema. I need access to nested types and have commonly used the following method:
type Iresponse = myType[level1][level2]
This works great when there are no Maybes, meaning a possibility of it…

Michael
- 947
- 7
- 17
0
votes
1 answer
Error: Invalid hook call (Codegen & Apollo & Next.js)
I tried to use generated hook from Codegen to do the signup mutation:
export default function signUpComponent() {
const { register, handleSubmit } = useForm();
const [signUpMutation, { data, loading, error }] =…

Housoul
- 91
- 1
- 2
- 9
0
votes
0 answers
How to extract Typescript type from nullable nested object?
I am using graphql-codegen to generate Typescript typings for my React project. With graphql, you can set up queries to return only the properties that you need. This is useful but also results in pretty complex looking object types for my…

Jordan Lewallen
- 1,681
- 19
- 54
0
votes
0 answers
Error: Unknown argument: init @graphql-codegen/cli
I'm following this.
I installed @graphql-codegen/cli as a Dev dependency here is my package.json.
{
"dependencies": {
"@apollo/client": "^3.4.8",
"graphql": "^15.5.1",
"next": "11.1.0",
"react": "17.0.2",
"react-dom":…

crispengari
- 7,901
- 7
- 45
- 53
0
votes
2 answers
Make one Docker image wait for another to finish before building
I am very new to docker (apologies in advance for errors in my terminology / gaps in my knowledge) and have three services where one depends on one to finish before it can be built.
The repo is set up to have them both as submodules with the below…

Charklewis
- 4,427
- 4
- 31
- 69
0
votes
1 answer
Define GraphQL object type in .graphql files not working
I'm trying to make a mutation in type-graphql and one of the arguments is Object so:
@Mutation(() => Boolean)
async createProduct(
@Arg('name', () => String) name: string,
@Arg('price', () => Int) price: number,
@Arg('images', () =>…

Ardian
- 39
- 1
- 7