static void mapVariable(String objectPath, Map<String, Object> variables, MultipartFile multipartFile) {
      final List<String> segments = ImmutableList.copyOf(SPLITTER.split(objectPath));
      if (segments.size() < 2) {
         throw new IllegalArgumentException("Invalid object-path: " + objectPath);
      }
      if (!"variables".equals(segments.get(0))) {
         throw new IllegalArgumentException("Can only map into variables: " + objectPath);
      }

      Object currentLocation = variables;
      for (int i = 1; i < segments.size(); i++) {
         final String segmentName = segments.get(i);
         if (i == segments.size() - 1) {
            if (currentLocation instanceof Map) {
               if (MAP_MAPPER.set((Map<String, Object>) currentLocation, segmentName, multipartFile) != null) {
                  throw new IllegalArgumentException("Expected null value when mapping: " + objectPath);
               }
            } else if (currentLocation instanceof List) {
               if (LIST_MAPPER.set((List<Object>) currentLocation, segmentName, multipartFile) != null) {
                  throw new IllegalArgumentException("Expected null value when mapping: " + objectPath);
               }
            } else {
               throw new IllegalArgumentException(
                       "Invalid type: " + currentLocation + " (expected: Map or List)");
            }
         } else {
            if (currentLocation instanceof Map) {
               currentLocation = MAP_MAPPER.recurse((Map<String, Object>) currentLocation, segmentName);
            } else if (currentLocation instanceof List) {
               currentLocation = LIST_MAPPER.recurse((List<Object>) currentLocation, segmentName);
            }
            if (currentLocation == null) {
               throw new IllegalArgumentException(
                       "Found null intermediate value when trying to map: " + objectPath);
            }
         }
      }
   }
Mapper for handling populating the query variables with the files specified by object paths
in the multi-part request.
graphql-protocol/src/main/java/com/linecorp/armeria/server/graphql/protocol/MultipartVariableMapper.java