Skip to content

Commit 655c625

Browse files
committed
Use existing key for Admin OAS Patch (#1913)
* Use global key in admin oas patch * rm deepcopy * Use Patch example
1 parent 76186ec commit 655c625

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pygeoapi/openapi.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,14 @@ def get_admin(cfg: dict) -> dict:
721721
res_eg = {
722722
res_eg_key: cfg['resources'][res_eg_key]
723723
}
724+
if 'extents' in res_eg[res_eg_key]:
725+
res_eg_eg_key = 'extents'
726+
elif 'type' in res_eg[res_eg_key]:
727+
res_eg_eg_key = 'type'
728+
729+
res_eg[res_eg_key]['patch_example'] = {
730+
res_eg_eg_key: res_eg[res_eg_key][res_eg_eg_key]
731+
}
724732

725733
paths['/admin/config'] = {
726734
'get': {
@@ -887,7 +895,7 @@ def get_admin(cfg: dict) -> dict:
887895
'description': 'Updates admin configuration resource',
888896
'content': {
889897
'application/json': {
890-
'example': {'extents': res_eg[res_eg_key]['extents']},
898+
'example': res_eg[res_eg_key]['patch_example'],
891899
'schema': schema_dict['properties']['resources']['patternProperties']['^.*$'] # noqa
892900
}
893901
},

0 commit comments

Comments
 (0)