Class FileUploadMutation

java.lang.Object
com.netflix.graphql.dgs.example.datafetcher.FileUploadMutation

public class FileUploadMutation extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    uploadFile(com.netflix.graphql.dgs.example.datafetcher.FileUploadMutation.FileUploadInput input, graphql.schema.DataFetchingEnvironment dfe)
    Implementation of the _Data Fetcher_ that will handle file upload.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FileUploadMutation

      public FileUploadMutation()
  • Method Details

    • uploadFile

      public boolean uploadFile(com.netflix.graphql.dgs.example.datafetcher.FileUploadMutation.FileUploadInput input, graphql.schema.DataFetchingEnvironment dfe)
      Implementation of the _Data Fetcher_ that will handle file upload. To test file upload via the command line you will first have to create a file, let's say we name it a.txt and contains only Hello World!. After that, you can use the curl command to execute the filue upload of one file as follows: <pre> curl -a http://localhost:8080/graphql \ --header "graphql-require-preflight:true" \ -F operations='{ "query" : "mutation ($file: Upload!) { uploadFile(input: { files:[$file]} ) }", "variables": {"file": null } }' \ -F map='{ "0": ["variables.file"] }' \ -F 0=@a.txt </pre>
      Parameters:
      input - the GraphQL input argument of type FileUploadInput, serialized to the java pojo FileUploadInput.
      dfe - the Data Fetching Environment
      Returns:
      boolean that will be true if all files are uploaded.