mirror of https://github.com/MISP/misp-objects
Add testing, update travis
parent
4f40e2e497
commit
1f2633c6f1
21
.travis.yml
21
.travis.yml
|
@ -1,17 +1,16 @@
|
|||
language: bash
|
||||
language: python
|
||||
|
||||
cache: pip
|
||||
|
||||
python:
|
||||
- "3.6"
|
||||
|
||||
sudo: required
|
||||
|
||||
dist: trusty
|
||||
|
||||
install:
|
||||
- git clone https://github.com/stedolan/jq.git
|
||||
- pushd jq
|
||||
- autoreconf -i
|
||||
- ./configure --disable-maintainer-mode
|
||||
- make
|
||||
- sudo make install
|
||||
- popd
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y -qq jq
|
||||
- pip install jsonschema
|
||||
|
||||
script:
|
||||
- cat */*/*.json | jq .
|
||||
- ./validate_all.sh
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Seeds sponge, from moreutils
|
||||
|
||||
for dir in objects/*/list.json
|
||||
do
|
||||
cat ${dir} | jq . | sponge ${dir}
|
||||
done
|
||||
|
||||
cat schema.json | jq . | sponge schema.json
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/schema#",
|
||||
"title": "Validator for misp-objects",
|
||||
"id": "https://www.github.com/MISP/misp-objects/schema.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"meta-category": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
},
|
||||
"attributes": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"attributes",
|
||||
"version",
|
||||
"description",
|
||||
"meta-category",
|
||||
"name"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
./jq_all_the_things.sh
|
||||
|
||||
diffs=`git status --porcelain | wc -l`
|
||||
|
||||
if ![ $diffs -eq 0 ]; then
|
||||
echo "Please make sure you run ./jq_all_the_things.sh before commiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for dir in objects/*/list.json
|
||||
do
|
||||
echo -n "${dir}: "
|
||||
jsonschema -i ${dir} schema.json
|
||||
echo ''
|
||||
done
|
||||
|
Loading…
Reference in New Issue