Skip to content

Commit 1b446f0

Browse files
author
doublebyte1
committed
- Added admin key (set to false) on pygeoapi config example
- Added support for example payload on admin put config request
1 parent a42bea3 commit 1b446f0

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

pygeoapi-config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ server:
5353
# connection: /tmp/pygeoapi-process-manager.db
5454
# output_dir: /tmp/
5555
# ogc_schemas_location: /opt/schemas.opengis.net
56-
56+
admin: false # enable admin API
57+
5758
logging:
5859
level: ERROR
5960
#logfile: /tmp/pygeoapi.log
61+
6062

6163
metadata:
6264
identification:

pygeoapi/openapi.py

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

668668

669+
def get_put_admin(cfg: dict) -> dict:
670+
"""
671+
Creates the payload for the PUT admin config request
672+
673+
:param cfg: `dict` of configuration
674+
675+
:returns: dict of OpenAPI definition
676+
"""
677+
678+
cfg['metadata']['identification']['title']['en'] = 'New pygeoapi Title'
679+
cfg['metadata']['identification']['title']['fr'] = 'Nouveau pygeoapi Titre'
680+
681+
return cfg
682+
683+
669684
def get_admin(cfg: dict) -> dict:
670685
"""
671-
Generates an OpenAPI definition for the admin UI
686+
Generates an OpenAPI definition for the admin API
672687
673688
:param cfg: `dict` of configuration
674689
"""
@@ -707,7 +722,7 @@ def get_admin(cfg: dict) -> dict:
707722
'description': 'Updates admin configuration',
708723
'content': {
709724
'application/json': {
710-
'example': cfg,
725+
'example': get_put_admin(cfg),
711726
'schema': schema_dict
712727
}
713728
},

0 commit comments

Comments
 (0)