Conversation
|
@uekerman The MetaConfigurator offers a lot of attributes one can define that are not required in the existing tutorials. Which of them need to be supported in the config file to fulfill all requirements of the adapter config schema? From reading the guidelines, I suppose that |
There is a difference between ticking R.10 of the guidelines and ticking all required items. Ticking R.10 is IMO enough for the moment. Adding further features can be done in minor releases. Maybe easier to understand: we need all required attributes (only then does the config adhere to the schema). Something like this should work: {
"participant_name": "Fluid",
"precice_config_file_path": "../precice-config.xml",
"interfaces": [
{
"mesh_name": "Fluid-Mesh",
"write_data": [
{
"name": "Force"
}
],
"read_data": [
{
"name": "Velocity"
},
{
"name": "Temperature"
}
]
},
{
"mesh_name": "Fluid-Upstream-Mesh",
"write_data": [
{
"name": "Heat-Flux"
}
]
}
]
}Clear enough? |
There was a problem hiding this comment.
We need to add a checking mechanism of the type:
import json
from jsonschema import validate
from jsonschema.exceptions import ValidationError, SchemaError
try:
with open("precice_adapter_configuration_schema.json", "r") as schema_f:
schema = json.load(schema_f)
with open("precice-adapter-config.json", "r") as config_f:
config = json.load(config_f)
validate(instance=config, schema=schema)
print("Validation successful: The configuration file is valid.")
except ValidationError as ve:
print(f"Validation error: {ve.message}")
except SchemaError as se:
print(f"Schema error: {se.message}")
except json.JSONDecodeError as je:
print(f"Invalid JSON format: {je.msg}")that checks a user-provided configuration file with the config schema from precice_adapter_configuration_schema.json. How to get the schema file is still an open question. Manually copying over the file is one option.
|
As stated in precice/preeco-orga#64 (comment) an external Python tool to validate and check the configuration file with the schema will be provided. |
Main changes of this PR
The parsing procedure of the participant's config files has been adopted to be compatible with the adapter config schema defined here.
Author's checklist
CHANGELOG.mdif there are user-observable changes since the last release.Reviewers' checklist