graphql

How to fix 'Variable “$_v0_data” got invalid value' caused from data types relation - Mutation Resolver

守給你的承諾、 提交于 2021-01-29 11:28:48
问题 I am trying to setup relations between types and wrote a resolver to run a mutation that create the list values but getting the below error here is my mutation file async createList(parent, args, ctx, info) { const list = await ctx.db.mutation.createList( { data: { project: { connect: { id: args.projectId } }, ...args } }, info ); return list; } and here is my datamodel type Board { id: ID! @id title: String! createdAt: DateTime! @createdAt updatedAt: DateTime! @updatedAt lists: [List]! }

Using two handlers for a GraphQL project; handle query with the second one if the first one is not capable of

江枫思渺然 提交于 2021-01-29 10:17:16
问题 I'm trying to use both SuperGraph as-a-library and GqlGen. So I have two handlers: the first one is SuperGraph ; this checks that it can carry out the operation the second one is GqlGen ; this checks that it can carry out the operation if the first one can't The code I'm using is this: type reqBody struct { Query string `json:"query"` } func Handler(sg *core.SuperGraph, next http.Handler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { bodyBytes, _ := ioutil.ReadAll(r

Solving relationships in Mongoose and GraphQL

↘锁芯ラ 提交于 2021-01-29 09:55:47
问题 So, I have this app that I'm starting and I'm going with MERNG stack using Apollo. I was doing research by reading blog posts and watching videos in order to have a better understanding of how GraphQL works (never actually worked with it). At some point, I started to see examples of relationships between db models such as "posts from a user". For example: import { model, Schema } from 'mongoose'; const postSchema = new Schema( { title: String, createdBy { type: Schema.Types.ObjectId, ref:

Github GraphQl - How to get a list of commits between tags

给你一囗甜甜゛ 提交于 2021-01-29 08:52:43
问题 With Github GraphQL I want to answer the question: What commits have been merged into master between releases/tags? The result should be similar to the results for this question Get commit list between tags in Git if I were to do it on the command line. I'm using the developer explorer and wondering if I will be able to do this with a single query or if I will need several. I tried the following but it does not give me the commits between tags that have not been tagged, just the tagged

Custom error status code with gqlgen + go gin

流过昼夜 提交于 2021-01-29 07:40:49
问题 Recently I have been updating my GO REST APIs into graphQl API's and I came across issue where I am unable to customise my status code with gqlgen. Response I got Headers Status Code: 200 OK { data: null, errors: [ {message: "Unauthorized access", path: ["..."]} ] } Expected Header Status Code: 401 UNAUTHORISED Any help would be really appreciating! 回答1: Assume you have a gqlgen resolver similar to this: func (r *queryResolver) SecretItems(ctx context.Context, userID string, password string)

Custom error status code with gqlgen + go gin

戏子无情 提交于 2021-01-29 07:35:21
问题 Recently I have been updating my GO REST APIs into graphQl API's and I came across issue where I am unable to customise my status code with gqlgen. Response I got Headers Status Code: 200 OK { data: null, errors: [ {message: "Unauthorized access", path: ["..."]} ] } Expected Header Status Code: 401 UNAUTHORISED Any help would be really appreciating! 回答1: Assume you have a gqlgen resolver similar to this: func (r *queryResolver) SecretItems(ctx context.Context, userID string, password string)

Custom field not saved

感情迁移 提交于 2021-01-29 07:34:45
问题 I try to add a custom user field to the user by using WPGraphQL. Therefore I tried to recreate the example in the official WPGraphQL documentation https://docs.wpgraphql.com/extending/fields/#register-fields-to-the-schema : add_action('graphql_init', function () { $hobbies = [ 'type' => ['list_of' => 'String'], 'description' => __('Custom field for user mutations', 'your-textdomain'), 'resolve' => function ($user) { $hobbies = get_user_meta($user->userId, 'hobbies', true); return !empty(

Error: Invariant Violation: gatsby-source-graphql requires option `typeName` to be specified

橙三吉。 提交于 2021-01-29 07:31:45
问题 I am new to GatsbyJs - GraphQL, I have been exploring the example provided by gatsby(https://github.com/gatsbyjs/gatsby/tree/master/examples/using-gatsby-source-graphql), As I tried with local apollo-grapql server, It returns data in the front-end, However it throws above error and blocks the build process, not sure what exactly is typeName I need to pass it in here? any help one this would be much appreciated. `gatsby-source-graphql`, { resolve: "gatsby-source-graphql", options: { // This

Vue.js apollo graphql sends request to localhost instead to certain endpoint

落花浮王杯 提交于 2021-01-29 07:15:35
问题 I configured a multiclient vue apollo, but for some reason it sends requests only to localhost. However I never specified a localhost endpoint. Here is my config file vue-apollo.js: import Vue from "vue"; import VueApollo from "vue-apollo"; import { createApolloClient, restartWebsockets } from "vue-cli-plugin-apollo/graphql-client"; Vue.use(VueApollo); const AUTH_TOKEN = "apollo-token"; const httpsEndpoint = process.env.VUE_APP_GRAPHQL_HTTPS || "https://myst.endpoint.prod/graphql"; export

Cannot determine GraphQL input type for argument named

怎甘沉沦 提交于 2021-01-29 07:06:59
问题 I have two relationed models: 1.- RoleEntity import { Column, Entity, BaseEntity, OneToMany, PrimaryColumn } from "typeorm"; import { Field, ObjectType } from "type-graphql"; import { UserEntity } from "./user.entity"; @ObjectType() @Entity({ name: "tb_roles" }) export class RoleEntity extends BaseEntity { @Field() @PrimaryColumn({ name: "id", type: "character varying", length: 5 }) id!: string; @Field() @Column({ name: "description", type: "character varying", nullable: true }) description!: