Hi all, I use graphql-import to import generated s...
# orm-help
v
Hi all, I use graphql-import to import generated schema by graphqlgen. I want to add some fields to the imported types. Is there a way? I couldn't find anything on the subject
h
I can't understand your question. graphqlgen generates types for resolvers and scaffold type safe resolver. I doesn't generate any schema I believe
v
You are right, it does not. My mistake. I guess prisma-client generates it. I have the following config:
```
Copy code
generate:
  - generator: typescript-client
    output: ../src/generated/prisma-client/
  - generator: graphql-schema
    output: ../src/generated/graphql-schema/
in prisma.yml
h
If you want to add some fields then you need to redefine that field in your schema file and then resolve those custom things in the server
v
The thing is that the schema is auto-generated. If I change something in the generated file, it will be overwritten. I want to extend the schema somehow. Does that make sense to you?
Does it sound like a reasonable approach, if not, what are the alternatives? Can I customize the generator somehow?
h
ok if you want to extend a type then you can use apollo server's extend feature.https://www.apollographql.com/docs/graphql-tools/generate-schema.html#extend-types
v
right, so I extend the type, and then I need to write the custom resolver.
h
Yes you need to resolve that particular field 🙂
v
yes, right, ok
One more question please,
h
Ask 🙂
v
Is there a way to add some custom metadata properties to the schema, say additional validation rules, properties that can be accessed by the frontend
h
You can add validation in resolvers. I don't believe there is any way to add meta data.
v
on the backend yes, I want to frontend to be aware of the additional metadata. One way - a hack - is to use the description field
I might do that
let me buy you a beer 🙂
can I do that, maybe paypal?
h
🙂
v
done. Thank you for your time 🙂
🙌 1
h
Just realised I need to update my paypal me pic 😂
v
that's fair 🙂