Skip to content

Commit 10c5bbb

Browse files
committed
- added test to check if key exists, before using it
1 parent 9f9665e commit 10c5bbb

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pygeoapi/openapi.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,19 @@ def get_post_resource(res):
731731
return newres
732732

733733

734+
def get_patch_resource(res):
735+
"""
736+
Creates the payload for the PATCH resource admin request
737+
:param res: configuration resource
738+
:returns: resource patch
739+
"""
740+
741+
if 'extents' in res.keys():
742+
return {'extents': res['extents']}
743+
else:
744+
return ''
745+
746+
734747
def get_admin(cfg: dict) -> dict:
735748

736749
schema_dict = get_config_schema()
@@ -907,7 +920,7 @@ def get_admin(cfg: dict) -> dict:
907920
'description': 'Updates admin configuration resource',
908921
'content': {
909922
'application/json': {
910-
'example': {'extents': res_eg[res_eg_key]['extents']},
923+
'example': get_patch_resource(res_eg[res_eg_key]),
911924
'schema': schema_dict['properties']['resources']['patternProperties']['^.*$'] # noqa
912925
}
913926
},

0 commit comments

Comments
 (0)