Skip to content

Commit

Permalink
Use existing key for Admin OAS Patch (#1913)
Browse files Browse the repository at this point in the history
* Use global key in admin oas patch

* rm deepcopy

* Use Patch example
  • Loading branch information
webb-ben authored Jan 29, 2025
1 parent a192aa6 commit 967dcf6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pygeoapi/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,14 @@ def get_admin(cfg: dict) -> dict:
res_eg = {
res_eg_key: cfg['resources'][res_eg_key]
}
if 'extents' in res_eg[res_eg_key]:
res_eg_eg_key = 'extents'
elif 'type' in res_eg[res_eg_key]:
res_eg_eg_key = 'type'

res_eg[res_eg_key]['patch_example'] = {
res_eg_eg_key: res_eg[res_eg_key][res_eg_eg_key]
}

paths['/admin/config'] = {
'get': {
Expand Down Expand Up @@ -887,7 +895,7 @@ def get_admin(cfg: dict) -> dict:
'description': 'Updates admin configuration resource',
'content': {
'application/json': {
'example': {'extents': res_eg[res_eg_key]['extents']},
'example': res_eg[res_eg_key]['patch_example'],
'schema': schema_dict['properties']['resources']['patternProperties']['^.*$'] # noqa
}
},
Expand Down

0 comments on commit 967dcf6

Please sign in to comment.