@@ -269,36 +269,42 @@ def get_input_params_table(_category_params, category_name) -> str:
269
269
270
270
return rst
271
271
272
- @staticmethod
273
- def get_output_params_table_rst (output_params_json ) -> str :
274
- """
275
- FIXME TODO consolidate with generated result schema
276
- """
272
+ def get_output_params_table_rst (self , output_params_json ) -> str :
273
+ output_schema = self .get_result_json_schema (output_params_json )
277
274
278
- output_params = json . loads ( output_params_json )
275
+ output_params_by_category : dict = {}
279
276
280
- output_rst = """
281
- .. list-table:: Output Parameters
277
+ for category , category_params in output_schema ['properties' ].items ():
278
+ if category not in output_params_by_category :
279
+ output_params_by_category [category ] = {} # []
280
+
281
+ for param_name , param in category_params ['properties' ].items ():
282
+ output_params_by_category [category ][param_name ] = param
283
+
284
+ def get_output_params_table (_category_params , category_name ) -> str :
285
+ category_display = category_name if category_name is not None else ''
286
+ _output_rst = f"""
287
+ { category_display }
288
+ { '-' * len (category_display )}
289
+ .. list-table:: { category_display } { ' ' if len (category_display ) > 0 else '' } Parameters
282
290
:header-rows: 1
283
291
284
292
* - Name
285
293
- Description
286
294
- Preferred Units
287
295
- Default Value Type"""
288
296
289
- for param_name in output_params :
290
- param = output_params [param_name ]
297
+ for _param_name , _param in _category_params .items ():
298
+ _output_rst += f"""\n * - { _param_name }
299
+ - { _get_key (_param , 'description' )}
300
+ - { _get_key (_param , 'units' )}
301
+ - { _get_key (_param , 'type' )} """
291
302
292
- def get_key (k ):
293
- if k in param and str (param [k ]) != '' : # noqa
294
- return param [k ] # noqa
295
- else :
296
- return ''
303
+ return _output_rst
297
304
298
- output_rst += f"""\n * - { param ['Name' ]}
299
- - { get_key ('ToolTipText' )}
300
- - { get_key ('PreferredUnits' )}
301
- - { get_key ('json_parameter_type' )} """
305
+ output_rst = ''
306
+ for category , category_params in output_params_by_category .items ():
307
+ output_rst += get_output_params_table (category_params , category )
302
308
303
309
return output_rst
304
310
@@ -343,6 +349,38 @@ def get_schema_title(self) -> str:
343
349
def get_result_json_schema (self , output_params_json ) -> dict :
344
350
return None # FIXME TODO
345
351
352
+ def get_output_params_table_rst (self , output_params_json ) -> str :
353
+ """
354
+ FIXME TODO consolidate with generated result schema
355
+ """
356
+
357
+ output_params = json .loads (output_params_json )
358
+
359
+ output_rst = """
360
+ .. list-table:: Output Parameters
361
+ :header-rows: 1
362
+
363
+ * - Name
364
+ - Description
365
+ - Preferred Units
366
+ - Default Value Type"""
367
+
368
+ for param_name in output_params :
369
+ param = output_params [param_name ]
370
+
371
+ def get_key (k ):
372
+ if k in param and str (param [k ]) != '' : # noqa
373
+ return param [k ] # noqa
374
+ else :
375
+ return ''
376
+
377
+ output_rst += f"""\n * - { param ['Name' ]}
378
+ - { get_key ('ToolTipText' )}
379
+ - { get_key ('PreferredUnits' )}
380
+ - { get_key ('json_parameter_type' )} """
381
+
382
+ return output_rst
383
+
346
384
347
385
def _get_logger (logger_name = None ):
348
386
sh = logging .StreamHandler (sys .stdout )
0 commit comments