Skip to content

Commit

Permalink
Merge branch 'main' into af176-hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecarenzo committed Aug 23, 2023
2 parents 6117865 + 9dbc195 commit 79808b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,16 @@ class AttackFlowValidator extends DiagramValidator {
this.addError(id, "Invalid email address.")
}
break;
case "file": {
const hashes = node.props.value.get("hashes");
case "file":
const hash = node.props.value.get("hashes");
const name = node.props.value.get("name");
if(!hash?.isDefined() && !name?.isDefined()) {
this.addError(id, "File requires one of the following properties: Hashes, Name");
}
if(hashes?.isDefined()) {
this.validateHash(id, hashes as ListProperty);
}
break;
}
case "grouping":
if(node.next.length === 0) {
this.addError(id, "A Grouping must point to at least one object.");
Expand Down
8 changes: 5 additions & 3 deletions src/attack_flow_builder/src/store/PageEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export class PageEditor {
let page = JSON.parse(file) as PageExport;

// Initialize diagram factory
let factory = await DiagramFactory.create(page.schema);
let factory = await DiagramFactory.create(Configuration.schema);

// Compile export index
let index = new Map<string, DiagramObjectExport>();
Expand Down Expand Up @@ -306,7 +306,6 @@ export class PageEditor {
let doc: PageExport = {
version: pkg.version,
id: this.page.id,
schema: this.page.factory.getSchema(),
objects: [...this.page.getSubtree()].map(o => o.toExport()),
location: location
}
Expand Down Expand Up @@ -393,8 +392,11 @@ type PageExport = {

/**
* The page's internal schema.
* @deprecated
* Since version 2.1.0. Schemas now rest solely with the application and
* are no longer exported with each file.
*/
schema: BlockDiagramSchema
schema?: BlockDiagramSchema

/**
* The page's diagram objects.
Expand Down

0 comments on commit 79808b4

Please sign in to comment.