plugin-graphql icon indicating copy to clipboard operation
plugin-graphql copied to clipboard

GraphQL Upload support

Open mlaradji opened this issue 4 years ago • 0 comments

I'm attempting to use this plugin with Parse Server. I am able to get it working for simple field types. However, the plugin does not seem to work with the FileInfo type, which uses GraphQL upload. To my understanding, support for GraphQL upload can be added through https://github.com/jaydenseric/graphql-upload.

Vuex-orm model

export class Component extends Model {
  static entity = 'component';
  static primaryKey = 'objectId';

  static fields() {
    return {
      objectId: this.string(null),
      name: this.string(null),
      description: this.string(null),
      model: this.attr(null) // this is the FileInfo field
    };
  }
}

Request to Parse server

{
	"operationName": "Components",
	"query": "query Components {\n  components {\n    edges {\n      node {\n        objectId\n        name\n        description\n        model\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n",
	"variables": {}
}

Parse server response:

{
	"errors": [
		{
			"message": "Field \"model\" of type \"FileInfo\" must have a selection of subfields. Did you mean \"model { ... }\"?",
			"locations": [
				{
					"line": 8,
					"column": 9
				}
			],
			"extensions": {
				"code": "GRAPHQL_VALIDATION_FAILED",
				"exception": {
					"stacktrace": [
						"GraphQLError: Field \"model\" of type \"FileInfo\" must have a selection of subfields. Did you mean \"model { ... }\"?",
						"    at Object.Field (/parse-server/node_modules/graphql/validation/rules/ScalarLeafsRule.js:40:31)",
						"    at Object.enter (/parse-server/node_modules/graphql/language/visitor.js:323:29)",
						"    at Object.enter (/parse-server/node_modules/graphql/utilities/TypeInfo.js:370:25)",
						"    at visit (/parse-server/node_modules/graphql/language/visitor.js:243:26)",
						"    at Object.validate (/parse-server/node_modules/graphql/validation/validate.js:69:24)",
						"    at validate (/parse-server/node_modules/apollo-server-core/dist/requestPipeline.js:221:34)",
						"    at Object.<anonymous> (/parse-server/node_modules/apollo-server-core/dist/requestPipeline.js:118:42)",
						"    at Generator.next (<anonymous>)",
						"    at fulfilled (/parse-server/node_modules/apollo-server-core/dist/requestPipeline.js:5:58)",
						"    at processTicksAndRejections (internal/process/task_queues.js:93:5)"
					]
				}
			}
		}
	]
}

mlaradji avatar Jan 25 '21 01:01 mlaradji