@@ -127,7 +127,8 @@ public static String parseOpDocument(String inputYamlPath)
127127 version = (String ) opsYaml .remove (VERSION_KEY );
128128 }
129129 if (opsYaml .containsKey (AUTHOR_KEY )) {
130- authors = (List <String >) opsYaml .remove (AUTHOR_KEY );
130+ authors = getListHelper (AUTHOR_KEY , opsYaml );
131+ opsYaml .remove (AUTHOR_KEY );
131132 }
132133
133134 // We assume the remaining entries are nested maps of classes to (maps of
@@ -155,17 +156,19 @@ public static String parseOpDocument(String inputYamlPath)
155156 if (opMetadata .containsKey (ALIAS_KEY )) {
156157 Object alias = opMetadata .get (ALIAS_KEY );
157158 if (alias instanceof String ) {
158- opNames .add ((String )alias );
159- } else if (alias instanceof List ) {
160- opNames .addAll ((List <String >)alias );
159+ opNames .add ((String ) alias );
161160 }
162- } else {
161+ else if (alias instanceof List ) {
162+ opNames .addAll ((List <String >) alias );
163+ }
164+ }
165+ else {
163166 opNames .add ("ext." + methodName );
164167 }
165168
166169 List <String > opAuthors = authors ;
167170 if (opMetadata .containsKey (AUTHOR_KEY )) {
168- opAuthors = ( List < String >) opMetadata . get ( AUTHOR_KEY );
171+ opAuthors = getListHelper ( AUTHOR_KEY , opMetadata );
169172 }
170173
171174 // If a global namespace is specified, we also alias the Op by its
@@ -197,6 +200,22 @@ public static String parseOpDocument(String inputYamlPath)
197200 return new Yaml ().dump (data );
198201 }
199202
203+ /**
204+ * Helper method to extract a key from a map that may point to a single
205+ * {@link String}, or a {@link List} thereof.
206+ */
207+ private static List <String > getListHelper (String key ,
208+ Map <String , Object > map )
209+ {
210+ Object value = map .get (key );
211+ if (value instanceof List ) {
212+ return (List <String >) value ;
213+ }
214+ List <String > result = new ArrayList <>();
215+ result .add ((String ) value );
216+ return result ;
217+ }
218+
200219 /**
201220 * Helper method to generate a properly formatted "source" string
202221 *
0 commit comments