0.3.0: .archify files are YAML and open straight into the diagram
- .archify content is YAML (JSON still accepted); converted to JSON for the renderer - Archify Diagram custom editor is the default for *.archify; Show Source opens the YAML beside it - YAML syntax errors and validation problems mapped to YAML lines - yamlValidation for schema completion with redhat.vscode-yaml - scripts/to-yaml.mjs converts existing .archify files
This commit is contained in:
+3
-2
@@ -3,6 +3,7 @@ import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { test } from 'node:test';
|
||||
import Ajv2020 from 'ajv/dist/2020';
|
||||
import { parse as parseYaml } from 'yaml';
|
||||
|
||||
const root = path.resolve(__dirname, '..', '..');
|
||||
const schemas = path.join(root, 'schemas');
|
||||
@@ -27,14 +28,14 @@ test('bundled schemas carry no absolute $id', () => {
|
||||
test('the .archify schema accepts every fixture', () => {
|
||||
const validate = validator();
|
||||
for (const file of fs.readdirSync(fixtures)) {
|
||||
const ok = validate(JSON.parse(fs.readFileSync(path.join(fixtures, file), 'utf8')));
|
||||
const ok = validate(parseYaml(fs.readFileSync(path.join(fixtures, file), 'utf8')));
|
||||
assert.ok(ok, `${file}: ${JSON.stringify(validate.errors?.slice(0, 3))}`);
|
||||
}
|
||||
});
|
||||
|
||||
test('the .archify schema applies the schema of the declared type', () => {
|
||||
const validate = validator();
|
||||
const sequence = JSON.parse(fs.readFileSync(path.join(fixtures, 'cache-miss.archify'), 'utf8'));
|
||||
const sequence = parseYaml(fs.readFileSync(path.join(fixtures, 'cache-miss.archify'), 'utf8'));
|
||||
// A sequence diagram is not a valid architecture diagram.
|
||||
assert.equal(validate({ ...sequence, diagram_type: 'architecture' }), false);
|
||||
assert.equal(validate({ ...sequence, diagram_type: 'poster' }), false);
|
||||
|
||||
Reference in New Issue
Block a user