Skip to content

Commit

Permalink
informative messages when checking schema
Browse files Browse the repository at this point in the history
  • Loading branch information
metelkin committed Sep 10, 2024
1 parent 2273eee commit dab11fc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 157 deletions.
15 changes: 10 additions & 5 deletions migrate-to-v0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,21 @@ The old inline export syntax will be supported in the current version (as depric
}
```

1. Remove unnecessary properties from the declaration file if you used them before:

- `options.skipExport`: use `export: []` instead
- `options.juliaOnly`: use `export: [{format: Julia}]` instead

1. If you used command line options to supress export with `heta build --no-export` then you should use now `heta build --export ''`.

If you used line options to build julia code only with `heta build --julia-only` then you should use now `heta build --export 'Julia'`.

1. Remove all inline `#export` actions from the .heta files and add them to the `export` array in the declaration file.

See details in [export formats](./export-formats.md)

**Before**
```heta
```hetas
// in index.heta
#export {format: DBSolve, filepath: model, powTransform: function};
#export {format: SBML, version: L3V2};
Expand All @@ -78,8 +87,4 @@ See details in [export formats](./export-formats.md)
]
```

1. If you used command line options to supress export with `heta build --no-export` then you should use now `heta build --export ''`.

If you used line options to build julia code only with `heta build --julia-only` then you should use now `heta build --export 'Julia'`.

1. Check building with `heta build` and make a commit if you use git.
5 changes: 4 additions & 1 deletion src/builder/declaration-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
"builderVersion": {"type": "string", "default": "*"},
"options": {
"type": "object",
"additionalProperties": false,
"additionalProperties": {
"not": true,
"errorMessage": "${0#} is unknown key in options"
},
"properties": {
"logMode": {"type": "string", "default": "error", "enum": ["never", "error", "always"]},
"logPath": {"type": "string", "default": "build.log"},
Expand Down
149 changes: 0 additions & 149 deletions src/builder/index-online.js

This file was deleted.

5 changes: 3 additions & 2 deletions src/builder/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const path = require('path');
const declarationSchema = require('./declaration-schema');
const Ajv = require('ajv');
const ajv = new Ajv({ useDefaults: true }); //.addSchema(declarationSchema);
const ajv = new Ajv({ useDefaults: true, allErrors: true }); //.addSchema(declarationSchema);
require('ajv-errors')(ajv);
const Container = require('../container');
const HetaLevelError = require('../heta-level-error');
const ModuleSystem = require('../module-system');
Expand Down Expand Up @@ -61,7 +62,7 @@ class Builder {
if (!valid) {
// convert validation errors to heta errors
validate.errors.forEach((x) => {
logger.error(`${x.dataPath} ${x.message}`, {type: 'BuilderError'});
logger.error(`${x.message} (${x.dataPath})`, {type: 'BuilderError', params: x.params});
});
throw new HetaLevelError('Wrong structure of platform file.');
}
Expand Down

0 comments on commit dab11fc

Please sign in to comment.