SOF-7827: introduce applications schema with build config#388
SOF-7827: introduce applications schema with build config#388
Conversation
…alProperties to false
| "type": "object" | ||
| } | ||
| }, | ||
| "application": { |
schema/workflow/base.json
Outdated
| } | ||
| }, | ||
| "application": { | ||
| "description": "information about the simulation engine/application.", |
There was a problem hiding this comment.
Information about the "main application" used for categorization purposes
| addFormats(ajvValidatorAndCleaner); | ||
| addFormats(ajvValidatorAndCleanerNoDefaults); | ||
| addFormats(ajvValidatorAndCleanerWithCoercingTypes); | ||
| addFormats(ajvValidatorAndCleanerWithCoercingTypesNoDefaults); |
There was a problem hiding this comment.
@pranabdas, why may we not want to use schemas default values?
There was a problem hiding this comment.
@k0stik while validating and cleaning schemas with validateAndClean, it is injecting default properties such as schemaVersion, which are not present in the original schema. This gives the option to avoid that behavior.
esse/schema/system/schema_version.json
Line 10 in 3fb9fa1
There was a problem hiding this comment.
Consider this example:
import { validateAndClean } from "@mat3ra/esse/dist/js/utils/ajv";
const schema = {
"$id": "test-schema",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"default": {
"type": "string",
"default": "default"
},
}
}
const data1 = {
"name": "test"
}
const data2 = {
"name": "test"
}
// default behavior
validateAndClean(data1, schema);
console.log(data1); // { name: 'test', default: 'default' }
// with useDefaults: false
validateAndClean(data2, schema, { useDefaults: false });
console.log(data2); // { name: 'test'}There was a problem hiding this comment.
@k0stik - are we converged here to proceed? If yes, please approve the PR
| "type": "object", | ||
| "$ref": "application/build_config.json" | ||
| }, | ||
| "additionalProperties": true |
There was a problem hiding this comment.
Is there a real need for "additionalProperties": true here and in other schemas? This prevents AJV from cleaning redundant data, and in most cases, we can avoid using additionalProperties
There was a problem hiding this comment.
In case we need additionalProperties, it should be placed on the same level as properties and allOf, not inside properties.
Correct:
{
"allOf": [...],
"properties": {...},
"additionalProperties": true
}Wrong:
{
"allOf": [...],
"properties": {
"additionalProperties": true
},
}There was a problem hiding this comment.
Definitely can remove it here. Actually, I had to remove additionalProperties from schema/software/application.json to be able to clean unwanted keys. But not sure about numerous other places.
| }, | ||
| "basename": { | ||
| "description": "Base filename of the result file", | ||
| "type": "string" |
There was a problem hiding this comment.
Maybe we can add "additionalProperties" as OK, but filename, basename should not be there
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "title": "application versions with build config schema", | ||
| "type": "object", | ||
| "properties": { |
There was a problem hiding this comment.
Since we are defining this item from scratch, I think we should follow the previous convention for camelCase, to stay consistent and avoid any potential issues when generating Py/TS assets.
module_name => moduleName
image_tag => imageTag
It would require a one-time change in the infrastructure configs, but it keeps ESSE clean.
No description provided.