Remove config_path setting and amend regex in mbed config JSON schema

- Removed the config_path setting from schema and moved the addition of the
config_path value after the validation is done.

- Altered the macro validation regex to be more lenient. Now verifies that
  if '=' is used in the macro definition that something comes after it.
pull/5022/head
Steven Cartmell 2017-09-06 11:24:13 +01:00
parent d208421efc
commit 3ff7de9771
3 changed files with 4 additions and 12 deletions

View File

@ -465,8 +465,6 @@ class Config(object):
sys.stderr.write(str(exc) + "\n") sys.stderr.write(str(exc) + "\n")
continue continue
cfg["__config_path"] = full_path
# Validate the format of the JSON file based on the schema_lib.json # Validate the format of the JSON file based on the schema_lib.json
schema_path = os.path.join(os.path.dirname(__file__), schema_path = os.path.join(os.path.dirname(__file__),
"schema_lib.json") "schema_lib.json")
@ -477,6 +475,8 @@ class Config(object):
if errors: if errors:
raise ConfigException(",".join(x.message for x in errors)) raise ConfigException(",".join(x.message for x in errors))
cfg["__config_path"] = full_path
# If there's already a configuration for a module with the same # If there's already a configuration for a module with the same
# name, exit with error # name, exit with error
if self.lib_config_data.has_key(cfg["name"]): if self.lib_config_data.has_key(cfg["name"]):

View File

@ -95,13 +95,9 @@
"type": "array", "type": "array",
"items": { "items": {
"type": "string", "type": "string",
"pattern": "^([A-Za-z0-9_]+|[A-Za-z0-9_]+=[0-9]+|[A-Za-z0-9_]+=\\\".*\\\")$" "pattern": "(^[\\w]+$|^[\\w]+=.+$)"
} }
}, },
"__config_path": {
"description": "Path to configuration file",
"type": "string"
},
"artifact_name": { "artifact_name": {
"type": "string" "type": "string"
} }

View File

@ -95,12 +95,8 @@
"type": "array", "type": "array",
"items": { "items": {
"type": "string", "type": "string",
"pattern": "^([A-Za-z0-9_]+|[A-Za-z0-9_]+=[0-9]+|[A-Za-z0-9_]+=\\\".*\\\")$" "pattern": "(^[\\w]+$|^[\\w]+=.+$)"
} }
},
"__config_path": {
"description": "Path to configuration file",
"type": "string"
} }
}, },
"required": [ "required": [