Skip to content

Commit 6e5bff8

Browse files
author
doublebyte1
committed
- Added support for example payload on admin patch config request
1 parent 1b446f0 commit 6e5bff8

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

pygeoapi/openapi.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def get_config_schema():
666666
return yaml_load(fh2)
667667

668668

669-
def get_put_admin(cfg: dict) -> dict:
669+
def get_put_config(cfg: dict) -> dict:
670670
"""
671671
Creates the payload for the PUT admin config request
672672
@@ -681,6 +681,21 @@ def get_put_admin(cfg: dict) -> dict:
681681
return cfg
682682

683683

684+
def get_patch_config(cfg: dict) -> dict:
685+
"""
686+
Creates the payload for the PATCH admin config request
687+
688+
:param cfg: `dict` of configuration
689+
690+
:returns: dict of OpenAPI definition
691+
"""
692+
693+
cfg['metadata']['identification']['title']['en'] = 'Patched pygeoapi'
694+
cfg['resources'] = {}
695+
696+
return cfg
697+
698+
684699
def get_admin(cfg: dict) -> dict:
685700
"""
686701
Generates an OpenAPI definition for the admin API
@@ -722,7 +737,7 @@ def get_admin(cfg: dict) -> dict:
722737
'description': 'Updates admin configuration',
723738
'content': {
724739
'application/json': {
725-
'example': get_put_admin(cfg),
740+
'example': get_put_config(cfg),
726741
'schema': schema_dict
727742
}
728743
},
@@ -743,6 +758,7 @@ def get_admin(cfg: dict) -> dict:
743758
'description': 'Updates admin configuration',
744759
'content': {
745760
'application/json': {
761+
'example': get_patch_config(cfg),
746762
'schema': schema_dict
747763
}
748764
},

0 commit comments

Comments
 (0)