Skip to content

Commit

Permalink
Also validate JSON schema for config generator (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitblanc authored Feb 28, 2024
1 parent 26343d9 commit 10b1c85
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/config_generator/config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ def __init__(self, config, logger, config_file_dir):
# get path to downloaded JSON schema files
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(
"'%s' service config validates against schema" % self.config.get('service', '')
)
else:
self.logger.error(
"'%s' service config failed schema validation" % self.config.get('service', '')
)

# create service config handlers
self.config_handler = {
# services with resources
Expand Down

0 comments on commit 10b1c85

Please sign in to comment.