Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check-circle

GitHub Action

CASE Ontology Validator

v2.7.0

CASE Ontology Validator

check-circle

CASE Ontology Validator

Validates files within a directory for compliance with the CASE Cyber Ontology

Installation

Copy and paste the following snippet into your .yml file.

              

- name: CASE Ontology Validator

uses: kchason/case-validation-action@v2.7.0

Learn more about this action in kchason/case-validation-action

Choose a version

CASE Validation Action

This is an unofficial GitHub Action and not endorsed by the CASE Community or the Linux Foundation. No warranties or guarantees are made to its accuracy or functionality.

Repository Checks CASE Version Latest Tag Docker Build Status Docker Pulls

Overview

A GitHub Action validator for the CASE Cyber Ontology which is available at https://caseontology.org/.

This is based on the case_validate library included in the CASE Utilities project available at: https://github.com/casework/CASE-Utilities-Python.

This is also available as a Docker image at: https://hub.docker.com/r/kchason/case-validator

GitHub Action Usage

Include the validation action in your GitHub action workflow and specify the file or directory to be validated.

# Run the CASE validation job to confirm the output is valid
- name: CASE Export Validation
  uses: kchason/case-validation-action@v2.7.0
  with:
    case-path: ./output/
    case-version: "case-1.2.0"
    extension-filter: "jsonld"

Docker Usage

Alternatively, the Docker image can be pulled from Docker Hub and run locally or as part of custom integrations.

The environment variables are defined below in the "Inputs" table, and the below command is an example that can be modified to fit custom use cases.

# To run the latest image and remove the container after execution. 
docker run --rm \
	-e CASE_PATH="/opt/case/" \
	-e CASE_VERSION="case-1.2.0" \
	-e CASE_EXTENSION_FILTER="jsonld" \
	-v "/path/to/local:/opt/case" \
	kchason/case-validator:latest

GitLab CI/CD Usage

The built container image available on Docker Hub can also be integrated into GitLab CI/CD to validate files in the source repository.

Example usage and documentation are available in a demo project on GitLab at https://gitlab.com/keith.chason/case-validation-example.

Inputs

Action Variable Environment Variable Description Options Default
case-path CASE_PATH The path to the file or directory to be validated. Any /opt/json
case-version CASE_VERSION The version of the ontology against which the graph should be validatated. "none", "case-0.5.0", "case-0.6.0" , "case-0.7.0", "case-0.7.1", "case-1.0.0", "case-1.1.0", "case-1.2.0" "case-1.2.0"
extension-filter CASE_EXTENSION_FILTER The extension of only the files against which the validator should be run. Eg. "json", "jsonld", "case". Defaults to "" to run against all files defined in case-path. Any ""
abort CASE_VALIDATE_ABORT Whether to abort the validator on the first failure "true", "false" "false"

Example Output

Output will be listed linearly if multiple files are provided

Conforming

Validating file at ./output/case.json
Validation Report
Conforms: True

Non-Conforming

Validating file at ./output/case.json
Validation Report
Conforms: False
Results (2):
Constraint Violation in MinCountConstraintComponent (http://www.w3.org/ns/shacl#MinCountConstraintComponent):
	Severity: sh:Violation
	Source Shape: [ sh:class core:UcoObject ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:nodeKind sh:BlankNodeOrIRI ; sh:path core:object ]
	Focus Node: kb:provenance-record-58e7566a-a934-4513-93b2-98fd43978a1c
	Result Path: core:object
	Message: Less than 1 values on kb:provenance-record-58e7566a-a934-4513-93b2-98fd43978a1c->core:object
Constraint Violation in MinCountConstraintComponent (http://www.w3.org/ns/shacl#MinCountConstraintComponent):
	Severity: sh:Violation
	Source Shape: [ sh:class core:UcoObject ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:nodeKind sh:BlankNodeOrIRI ; sh:path core:object ]
	Focus Node: kb:provenance-record-a22fc197-6e53-4bc0-9832-d0b9f2b733d3
	Result Path: core:object
	Message: Less than 1 values on kb:provenance-record-a22fc197-6e53-4bc0-9832-d0b9f2b733d3->core:object