-
-
Notifications
You must be signed in to change notification settings - Fork 8
Follow the adapter config schema #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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