sigram commented on a change in pull request #1225: SOLR-14233: 
JsonSchemaCreator should support Map payloads
URL: https://github.com/apache/lucene-solr/pull/1225#discussion_r373108855
 
 

 ##########
 File path: 
solr/solrj/src/java/org/apache/solr/common/util/JsonSchemaCreator.java
 ##########
 @@ -57,10 +57,18 @@
   private static Map<String, Object> 
createSchemaFromType(java.lang.reflect.Type t, Map<String, Object> map) {
     if (natives.containsKey(t)) {
       map.put("type", natives.get(t));
-    } else if (t instanceof ParameterizedType && ((ParameterizedType) 
t).getRawType() == List.class) {
-      Type typ = ((ParameterizedType) t).getActualTypeArguments()[0];
-      map.put("type", "array");
-      map.put("items", getSchema(typ));
+    } else if (t instanceof ParameterizedType) {
+      if (((ParameterizedType) t).getRawType() == List.class) {
+        Type typ = ((ParameterizedType) t).getActualTypeArguments()[0];
+        map.put("type", "array");
+        map.put("items", getSchema(typ));
+      } else if (((ParameterizedType) t).getRawType() == Map.class) {
+        Type typ = ((ParameterizedType) t).getActualTypeArguments()[0];
 
 Review comment:
   This line can be removed - it's a no-op, I put it there because I thought I 
could use the type for something analogous to the List's "items".

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to