Skip to content

Commit 72fd0dc

Browse files
add links to schemas in parameters reference
1 parent a41ab0b commit 72fd0dc

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

src/geophires_x_schema_generator/__init__.py

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,38 @@ def get_input_params_table(_category_params, category_name) -> str:
253253

254254
output_rst = self.get_output_params_table_rst(output_params_json)
255255

256+
schema_ref_base_url = (
257+
'https://github.com/softwareengineerprogrammer/GEOPHIRES/blob/main/src/geophires_x_schema_generator/'
258+
)
259+
input_schema_ref_rst = ''
260+
if self.get_input_schema_reference() is not None:
261+
input_schema_ref_rst = (
262+
f'Schema: '
263+
f'`{self.get_input_schema_reference()} '
264+
f'<{schema_ref_base_url}{self.get_input_schema_reference()}>`__'
265+
)
266+
267+
output_schema_ref_rst = ''
268+
if self.get_output_schema_reference() is not None:
269+
output_schema_ref_rst = (
270+
f'Schema: '
271+
f'`{self.get_output_schema_reference()} '
272+
f'<{schema_ref_base_url}{self.get_output_schema_reference()}>`__'
273+
)
274+
256275
rst = f"""{self.get_schema_title()} Parameters
257276
==========
258277
259278
.. contents::
260279
261280
Input Parameters
262281
################
282+
{input_schema_ref_rst}
263283
{input_rst}
264284
265-
Output Parameters
285+
Outputs
266286
#################
287+
{output_schema_ref_rst}
267288
{output_rst}
268289
"""
269290

@@ -287,7 +308,7 @@ def get_output_params_table(_category_params, category_name) -> str:
287308
_output_rst = f"""
288309
{category_display}
289310
{'-' * len(category_display)}
290-
.. list-table:: {category_display}{' ' if len(category_display) > 0 else ''}Parameters
311+
.. list-table:: {category_display}{' ' if len(category_display) > 0 else ''}Outputs
291312
:header-rows: 1
292313
293314
* - Name
@@ -309,6 +330,12 @@ def get_output_params_table(_category_params, category_name) -> str:
309330

310331
return output_rst
311332

333+
def get_input_schema_reference(self) -> str:
334+
return 'geophires-request.json'
335+
336+
def get_output_schema_reference(self) -> str:
337+
return 'geophires-result.json'
338+
312339

313340
def _get_key(param: dict, k: str, default_val='') -> Any:
314341
if k in param and str(param[k]) != '':
@@ -358,7 +385,7 @@ def get_output_params_table_rst(self, output_params_json) -> str:
358385
output_params = json.loads(output_params_json)
359386

360387
output_rst = """
361-
.. list-table:: Output Parameters
388+
.. list-table:: Outputs
362389
:header-rows: 1
363390
364391
* - Name
@@ -382,6 +409,12 @@ def get_key(k):
382409

383410
return output_rst
384411

412+
def get_input_schema_reference(self) -> str:
413+
return 'hip-ra-x-request.json'
414+
415+
def get_output_schema_reference(self) -> str:
416+
return None
417+
385418

386419
def _get_logger(logger_name=None):
387420
sh = logging.StreamHandler(sys.stdout)

0 commit comments

Comments
 (0)