forked from metaphacts/ontodia
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable link validation: (metaphacts#159)
- change ValidationApi to be able to validate outbound links; - add ExampleValidationApi (see RDF example); - display link validation errors; - move element validation errors to authoring status line from template; - fix HashMap duplicate insertion. Co-authored-by: Alexey Morozov <[email protected]>
- Loading branch information
Showing
15 changed files
with
489 additions
and
281 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
import { ElementModel, LinkModel, LinkTypeIri, PropertyTypeIri } from './model'; | ||
import { DiagramModel } from '../diagram/model'; | ||
import { AuthoringState } from '../editor/authoringState'; | ||
import { CancellationToken } from '../viewUtils/async'; | ||
|
||
import { ElementModel, LinkModel, ElementIri, PropertyTypeIri } from './model'; | ||
|
||
export interface ElementError { | ||
message: string; | ||
linkType?: LinkTypeIri; | ||
propertyType?: PropertyTypeIri; | ||
readonly type: 'element'; | ||
readonly target: ElementIri; | ||
readonly message: string; | ||
readonly propertyType?: PropertyTypeIri; | ||
} | ||
|
||
export interface LinkError { | ||
message: string; | ||
readonly type: 'link'; | ||
readonly target: LinkModel; | ||
readonly message: string; | ||
} | ||
|
||
export interface ValidationApi { | ||
/** | ||
* Validates element model | ||
*/ | ||
validateElement(element: ElementModel, state: AuthoringState, ct: CancellationToken): Promise<ElementError[]>; | ||
export interface ValidationEvent { | ||
readonly target: ElementModel; | ||
readonly outboundLinks: ReadonlyArray<LinkModel>; | ||
readonly model: DiagramModel; | ||
readonly state: AuthoringState; | ||
readonly cancellation: CancellationToken; | ||
} | ||
|
||
export interface ValidationApi { | ||
/** | ||
* Validates link model | ||
* Validate element and its outbound links. | ||
*/ | ||
validateLink( | ||
link: LinkModel, source: ElementModel, target: ElementModel, ct: CancellationToken | ||
): Promise<LinkError[]>; | ||
validate(e: ValidationEvent): Promise<Array<ElementError | LinkError>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.