Questions tagged [typegraphql]
TypeGraphQL is a library that provides you some decorators, and you can use these decorators to define your parts of schema.
396
questions
0
votes
0
answers
9
views
Cannot determine GraphQL input type for argument when it has ArgsType
Given following code:
@Query(() => CompanyTalentRoster)
async findCompanyTalentRoster(
@Args() args: FindFirstCompanyTalentRosterArgs
): Promise<CompanyTalentRoster | null> {
...
0
votes
0
answers
23
views
TypeORM sort one to many relations
I have 2 TypeORM entity: Folder and User
Here are the details
@Entity({ name: "folder" })
@ObjectType()
export class Folder extends BaseEntity {
@Field()
@PrimaryGeneratedColumn()
id!: ...
0
votes
0
answers
18
views
Typescript does not see my type-graphql useMiddleware function
I have a resolver for creating posts and adding the authorId as a foreign key from my session.
@Mutation(() => PostType)
@UseMiddleware(isAuth)
async createPost(
@Arg('title') title: string,
...
0
votes
1
answer
17
views
Input object for GraphQL and TypeScript: at which point do I fill default values?
So this is more of a design question.
I have an object called Meaning (basically a dictionary record), and an input object called EntryMeaningInput. (I called it that because Entry [the headword, ...
0
votes
1
answer
53
views
Setting Pisma, Graphql, typegraphql-prisma project in a serverless aws lambda project
I am trying to configure a project that users Prisma, Graphql and serverless aws lambda. I am to use typegraphql-prisma.
This is my serverless.ts file. This was created when I am initilizing the ...
0
votes
0
answers
12
views
How can I access request headers in a Ts.ED graphql resolver?
I have a default installation of Ts.ED application using Prisma, TypeGraphql, Koa selected.
It created a standard config for graphql like this:
export const config: Partial<TsED.Configuration> = ...
1
vote
1
answer
51
views
TypeORM 0.3.12: FieldResolver() not returning expected results with where statement
I recently upgraded TypeORM from version 0.2.37 to 0.3.12. However, after the upgrade, the where statement is not returning any answers' entity even though there are records in the database that ...
1
vote
1
answer
37
views
GraphQL and PostgreSQL: non-nullable subfield causes "Cannot return null for non-nullable field" error
I have three type-graphql objects (and typeorm entities): Entry (dictionary headwords), Meaning (meanings of headwords) and Pronunciation (transcriptions of headwords).
There's a many-to-many ...
0
votes
0
answers
25
views
Cannot determine GraphQL output type for more than one generic classtypes
I have an issue with declaring an abstract ObjectType. I want to use two generics - one as an optional.
Here is an implementation of the interface:
interface IPaginationResponse<T, Parent> {
...
2
votes
0
answers
243
views
How to upload a file through Apollo Server v4 and graphql-upload?
im using Apollo server v4 with expressjs and NEXTJS for my Frontend. What I want is to create a Mutation like uploadFile using upload-graphql to upload a file to my Backend Server.
upload type
export ...
0
votes
0
answers
42
views
Is GraphQL with codegen support wildcard operation?
I'm using graphql-codegen to generate typescript type from graphql schema. I'm trying to perform wildcard operation.
query User($query: USERQueryInput){
user(query: $query){
_id
...
0
votes
0
answers
101
views
Save method in TypeORM not inserting related entity with ID set as null and primaryGeneratedColumn
I’m a bit of a TypeORM newbie, picking up a project and making some changes.
I’m trying to run asset.save() with the data at the bottom on a @OneToMany() relationship. I’m getting the following error. ...
1
vote
1
answer
181
views
why instaling type-graphql, @apollo/server and graphql together showing dependency error
I have been trying to install typegraphql with apollo/server in typescript node template but it showing dependency error, I don't know why all new version is not compatible with each other.
npm ERR! ...
0
votes
0
answers
31
views
Get input from nested GraphQL query
I have a nested GraphQL Query. I am using DataFetchingEnvironment to get the input. Please help on how to get the required input?
My Query:
query {
users (find: String) {
id
name
tasks(...
1
vote
2
answers
43
views
Getting a Type error when loading data from API in react using typescript
I am getting the following error:
ERROR in src/Components/Pages/Languages/LanguagesPage.tsx:41:29
TS2339: Property 'languageId' does not exist on type '[]'.
39 |
40 | {data.languages....
0
votes
0
answers
39
views
Typegoose and TypeGraphQL - @FieldResolver not working
I have try to get the user by the userid which stored in the notice, but I get undefined in the FieldResolver.
Notice Schema
@ObjectType({description: "Notice Schema"})
export class Notice ...
1
vote
0
answers
61
views
TypeGraphQL: ArgumentValidationError on mutation
I'm playing around with TypeGraphQL and have a simple api setup to query projects and their associated clients.
For my createClient mutation, I'm receiving an ArgumentValidation Error, 'an unknown ...
0
votes
1
answer
268
views
Integrating TypeGraphQL and file uploads with Apollo Server v4
The new apollo server v4 is out and I am having problem integrating TypeGraphQL with @apollo/server. I somehow integrated myself but getting this error. It says TypeGraphQL have ...
0
votes
0
answers
26
views
ValidationError: Using global EntityManager instance methods for context specific actions is disallowed
I am following a Ben Awad tutorial, and in this project, I am using Typescript, Mikro-Orm and GraphQL and am very much new to all this stuff.
I am getting the following error trace on GraphQL:
{
&...
0
votes
0
answers
28
views
Apollo and type-graphql can't find input mutation/query
I'm trying to pass an input to my graphql query and my resolver can't find the input
I have my docker container set to log info and I can see the input is being passed, the log that gets posted looks ...
0
votes
0
answers
195
views
Cursor based pagination using typeorm, typegraphql , postgresql
So i am trying to follow a tutorial but i am getting an error that says
'Provided "take" value is not a number. Please provide a numeric value.
So while in the apollo server playground i ...
0
votes
1
answer
93
views
How to create or update an entity in a single mutation
Is there an accepted pattern to create or update an item in a singlecreateOrUpdate mutation where the fields for creating and updating vary?
For example here is the type and the mutation i'm trying to ...
0
votes
0
answers
23
views
Design patterns for input types with unions
Lets say I have an entity that has a type signature like this (using typescript syntax):
type WordDocument = {
name: string,
lines: PossibleLineTypes[]
}
type ...
0
votes
1
answer
58
views
How to use TypeGraphQL with tsyringe
I have a project using tsyringe and a RESTFul API. Now i should to add a GraphQL API using the type-graphql but in our documentation no have some example using it.
Is possiblem to use tsyringe to make ...
0
votes
0
answers
28
views
Unexpected format when using fieldresolver from type-graphql with typegoose
The structure of my user object returned from typegoose is unexpected.
@Resolver((of) => User)
export class UserResolver {
@FieldResolver(() => String, { nullable: true })
email(@Root() user:...
0
votes
0
answers
40
views
Extent parameters in GraphQL
I've got graphQL code like below. My question is, if there is any option to write values of parameters as extent ? Or I must write all the values next to each other ?
For example, I want this [1-15], ...
0
votes
0
answers
205
views
GraphQL - How can I tell if my delete mutation has been created?
My react, apollo, prisma, nextjs typescript app seems to think I have not made a deleteIssueGroup mutation. I think I have.
I am using:
"devDependencies": {
"@graphql-codegen/add&...
0
votes
0
answers
16
views
Is it okay for a field-resolver to write to the database in typegraphql
I have a property which, every time that it is queried should return a new value. I need to keep track of this value so I need to save this to the database. This would lead to queries which request ...
1
vote
1
answer
91
views
How can I use the `graphql-scalars` package with `typegraphql`?
I would like to make use of the graphql-scalars package of the-guild.dev. However, I don't understand how I can integrate it with typegraphql. This is their quick start guide https://the-guild.dev/...
0
votes
0
answers
65
views
Unable to make graphQL query mutation for File Upload when using @GrpahQLScalar File file
Not able to create graph QL query mutation for file upload using @GraphQLScalar File when trying with this query getting 501 internal server error This is my graph QL query for file upload.
Please ...
0
votes
1
answer
456
views
How to specify DateTime in GraphQL schema?
I am building my GraphQL schema for my project and one of my models has a DateTime format.
How do I write out date formats on my GraphQL schema?
I tried DateTime or Date but nothing shows up.
This is ...
0
votes
1
answer
547
views
How to add a date to a prisma typescript form?
I am trying to figure out how to post a date to a prisma database.
I have a prisma.schema which has a createdAt field as follows:
createdAt DateTime @default(now()) @db.Timestamptz(6)
I made ...
1
vote
1
answer
38
views
How to merge results from two gql queries in to one array of results?
We have two services exposing two sets of schemas, merged in a gateway using Graphql Tools Schema Stitching
Is it possible to merge queries from two services in such a way that it returns combined ...
1
vote
2
answers
173
views
How to ensure enum order in graphql
I defined enum named by BlocksType in server
export enum BlocksType {
TEXT = "TEXT",
LINK = "LINK",
GALLERY = "GALLERY",
CONTACT = "CONTACT",
...
1
vote
2
answers
48
views
Graphql Introspection result does not contain relation columns
Thanks for taking time to review my question, I am executing an introspection query and the result contains tables and columns. As listed in the image below.
{
"name": "tbl_enterprise&...
0
votes
0
answers
132
views
How to import a GraphQL schema from my express-graphql server to my apollo client via Schema Link
So what my problem is that i have created a project and i have 2 separete folders.
One for the server side and one for the client side. I try to make a reddit clone based on ben awad's yt tutorial and ...
1
vote
0
answers
18
views
Testing graphql fieldresolver implementation
I would like to write a test in jest that checks if the all the field resolvers have been implemented.
Lets assume I have the following schema:
@ObjectType()
class Ingredients{
@Field(type => ID)
...
0
votes
0
answers
87
views
TypeOrm - Type-GraphQL : entity / resolver: How to create a rating-system
I'm developing an app similar to Google Maps.
The objective is to have users rate places of interest (POI) such as museums and restaurants. Each user can give at most 1 rating to a POI.
Example: user ...
0
votes
2
answers
146
views
How can I troubleshoot an error: lib/graphql has no exported mutation - for a mutation I have defined and which appears in graphql.tsx
I'm trying to figure out what I need to do in order to have lib/graphql recognise the mutations I have made.
I have an issue.tsx (which is a form). It imports:
import {
IssueInput,
...
0
votes
1
answer
111
views
typegraphql delegate query fields to field resolver
I want a user query which delegates it's fields to the field resolvers below. What do I return from the query to allow this behaviour?
@ObjectType()
class User {
@Field((_type) => ID)
id!: ...
-2
votes
1
answer
37
views
What does the argument to @Resolver for type-graphql do?
Honestly, just curious, on the documentation website for type-graphql, they pass an argument to the @Resolver decorator. Here is the link to the page where it occurs: https://typegraphql.com/docs/...
0
votes
0
answers
42
views
GitHub Graphql query
How to change the default branch of a repository by using graphql api. I write the query to get the default branch but I didn’t able to find how to change with another branch.
Thabkyou for the ...
1
vote
1
answer
398
views
How to I make a custom scalar type in graphql pothos?
I am trying to make a custom scalar type called JSONObject that will be applied to an input parameter that will accept an array of JSON-formatted documents and I cannot get it to work.
The type is ...
0
votes
0
answers
38
views
Create dynamically typed fields in graphQL with C#
I am trying to type the values of some fields (variables) that are loaded dynamically in a graphQL and where values of these fields have the form of key and value, but the value can be of three types:
...
0
votes
0
answers
17
views
How can I auto add a field(ex: objectId) for all object types in codegen similar to __typename in graphQL?
I am trying to do cache normalization for objects using custom id for each object but the flip side is that id needs to be present in selectionSet of each object. Is there a way to enforce that just ...
0
votes
2
answers
581
views
How To Throw Errors In Apollo Server v4?
thanks for looking into this. So I am trying to migrate my Apollo Server from V3 to V4, I have a resolver that type checks for an Access Token and returns it like so
export class LoginResolver {
@...
0
votes
0
answers
198
views
Failed to load @generated/type-graphql using Vitest
I'm trying to migrate from jest to vitest in a nodejs application. Using type-graphql, i'm not able to run the tests because of the generated files :
Error: [vite-node] Failed to load @generated/type-...
0
votes
2
answers
334
views
How to implement a reference type on a ObjectType that comes from a class in GraphQL pothos (Next JS)
I am trying to reference the money type onto my cart type I have tried a few different ways and keep getting this error:
:Ref function String() { [native code] } has not been implemented
In my project,...
1
vote
1
answer
47
views
How to exclude hooks from entity types in typeorm / typegraphql
Im sure this is a really common issue but I just cannot seem to find any accepted solutions.
When combining typeorm and typegraphql, you create entities with the properties of the entity. However ...
0
votes
0
answers
94
views
CannotDetermineGraphQLTypeError: Cannot determine GraphQL input type for
I am getting this below error while accessing the graphQL.
Error:
Here I need subStatus as dynamic object. I have taken ObjectType type decorator to make it dynamic object but it seems something is ...