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/3] 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/3] 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, From 0f162ccd8b3318646ab050d4887307d29871fd30 Mon Sep 17 00:00:00 2001 From: Colton Loftus <70598503+C-Loftus@users.noreply.github.com> Date: Mon, 5 Jan 2026 08:07:09 -0500 Subject: [PATCH 3/3] Update formatting --- pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml | 6 +++--- tests/other/test_config.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml b/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml index 6a5f068df..477526f0b 100644 --- a/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml +++ b/pygeoapi/resources/schemas/config/pygeoapi-config-0.x.yml @@ -132,9 +132,9 @@ properties: type: string description: plugin name (see `pygeoapi.plugin` for supported process_managers) connection: - oneOf: - - type: string - - type: object + type: + - string + - 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 c7e80fcf2..90734b5ee 100644 --- a/tests/other/test_config.py +++ b/tests/other/test_config.py @@ -110,7 +110,7 @@ def test_validate_config_process_manager(config): cfg_copy['server']['manager'] = { 'name': 'TinyDB', 'connection': '/tmp/pygeoapi_test.db', - 'output_dir': '/tmp/', + 'output_dir': '/tmp/' } assert validate_config(cfg_copy) @@ -119,7 +119,7 @@ def test_validate_config_process_manager(config): cfg_copy['server']['manager'] = { 'name': 'TinyDB', 'connection': 12345, - 'output_dir': '/tmp/', + 'output_dir': '/tmp/' } validate_config(cfg_copy) @@ -130,8 +130,8 @@ def test_validate_config_process_manager(config): 'port': 5432, 'database': 'pygeoapi', 'user': 'pygeoapi', - 'password': 'pygeoapi', + 'password': 'pygeoapi' }, - 'output_dir': '/tmp/', + 'output_dir': '/tmp/' } assert validate_config(cfg_copy)