Skip to content

Commit

Permalink
Fix config generator schema validation
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Mar 5, 2024
1 parent 257b86e commit fdd51a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions schemas/qwc-config-generator.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"type": "array",
"items": {
"description": "Generator config for a service",
"oneOf": [
"anyOf": [
{"$ref": "#/definitions/common_service"},
{"$ref": "#/definitions/mapViewer"},
{"$ref": "#/definitions/ogc"}
Expand All @@ -156,7 +156,6 @@
}
},
"required": [
"service",
"themesConfig",
"config",
"services"
Expand Down
8 changes: 4 additions & 4 deletions src/config_generator/config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,14 @@ def __init__(self, config, logger, config_file_dir):
self.json_schemas_path = os.environ.get('JSON_SCHEMAS_PATH', '/tmp/')

# validate config-generator JSON schema
self.logger.debug(f"Validate qwc-config-generator schema URL: {self.config.get('$schema', '')}")
if self.validate_schema(self.config, self.config.get('$schema', '')):
self.logger.debug("Validate qwc-config-generator schema URL")
if self.validate_schema(self.config, self.schema_urls["configGenerator"]):
self.logger.debug(
"'%s' service config validates against schema" % self.config.get('service', '')
"qwc-config-generator config validates against schema"
)
else:
self.logger.error(
"'%s' service config failed schema validation" % self.config.get('service', '')
"qwc-config-generator config failed schema validation"
)

# create service config handlers
Expand Down
4 changes: 4 additions & 0 deletions src/schema-versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"schemas": [
{
"service": "configGenerator",
"schema_url": "https://github.com/qwc-services/qwc-config-generator/raw/master/schemas/qwc-config-generator.json"
},
{
"service": "adminGui",
"schema_url": "https://github.com/qwc-services/qwc-admin-gui/raw/master/schemas/qwc-admin-gui.json"
Expand Down

0 comments on commit fdd51a0

Please sign in to comment.