From 3454e2a68646366abd8154429713c1745ce558c1 Mon Sep 17 00:00:00 2001 From: Colton Loftus <70598503+C-Loftus@users.noreply.github.com> Date: Tue, 18 Nov 2025 11:09:51 -0500 Subject: [PATCH 1/2] fix validation issue --- .../schemas/config/pygeoapi-config-0.x.yml | 6 ++-- tests/other/test_config.py | 35 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml b/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml index c1e925c39..6a5f068df 100644 --- a/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml +++ b/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml @@ -1,5 +1,5 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/geopython/pygeoapi/master/pygeoapi/schemas/config/pygeoapi-config-0.x.yml +$id: https://raw.githubusercontent.com/geopython/pygeoapi/refs/heads/master/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml title: pygeoapi configuration schema description: pygeoapi configuration schema @@ -132,7 +132,9 @@ properties: type: string description: plugin name (see `pygeoapi.plugin` for supported process_managers) connection: - type: string + oneOf: + - type: string + - type: object description: connection info to store jobs (e.g. filepath) output_dir: type: string diff --git a/tests/other/test_config.py b/tests/other/test_config.py index 0ab728ffe..221b7fa14 100644 --- a/tests/other/test_config.py +++ b/tests/other/test_config.py @@ -99,3 +99,38 @@ def test_validate_config(config): } with pytest.raises(ValidationError): validate_config(cfg_copy) + + +def test_validate_config_process_manager(config): + """ + Test that the process manager config can be validated + as both a string or an object (i.e. PostgreSQL or TinyDB) + """ + cfg_copy = deepcopy(config) + cfg_copy['server']['manager'] = { + 'name': 'TinyDB', + 'connection': '/tmp/pygeoapi_test.db', + 'output_dir': '/tmp/', + } + assert validate_config(cfg_copy) + + with pytest.raises(ValidationError): + cfg_copy['server']['manager'] = { + 'name': 'TinyDB', + 'connection': 12345, + 'output_dir': '/tmp/', + } + validate_config(cfg_copy) + + cfg_copy['server']['manager'] = { + 'name': 'PostgreSQL', + 'connection': { + 'host': 'localhost', + 'port': 5432, + 'database': 'pygeoapi', + 'user': 'pygeoapi', + 'password': 'pygeoapi', + }, + 'output_dir': '/tmp/', + } + assert validate_config(cfg_copy) From c1fb446eb0e7c8ddbcf54b8c04f5e9748169c692 Mon Sep 17 00:00:00 2001 From: Colton Loftus <70598503+C-Loftus@users.noreply.github.com> Date: Tue, 18 Nov 2025 11:10:03 -0500 Subject: [PATCH 2/2] fix validation issue --- tests/other/test_config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/other/test_config.py b/tests/other/test_config.py index 221b7fa14..c7e80fcf2 100644 --- a/tests/other/test_config.py +++ b/tests/other/test_config.py @@ -115,6 +115,7 @@ def test_validate_config_process_manager(config): assert validate_config(cfg_copy) with pytest.raises(ValidationError): + # make sure an int is validated as invalid cfg_copy['server']['manager'] = { 'name': 'TinyDB', 'connection': 12345,