Skip to content

Commit 25f1312

Browse files
authored
add CI test (#379)
* * add compound type support * add uint type * add titles * add workflow (#380)
1 parent 24fba61 commit 25f1312

File tree

2 files changed

+98
-8
lines changed

2 files changed

+98
-8
lines changed

.github/workflows/pythonapp.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Python application
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Set up Python 3.7
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: 3.7
16+
- name: Install hdmf
17+
run: |
18+
pip install git+https://github.com/hdmf-dev/hdmf.git
19+
- name: Validate schema specification
20+
run: |
21+
validate_hdmf_spec core -m nwb.schema.json

nwb.schema.json

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,64 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$id": "NWB.schema.json",
3+
"$id": "nwb.schema.json",
44
"title": "Schema for the NWB language specification",
5-
"description": "A schema for validating NWB YAML files",
5+
"description": "A schema for validating NWB YAML files and NWB extensions",
66
"version": "2.0.2",
77
"type": "object",
8+
"additionalProperties": false,
89
"properties": {
910
"groups": {"$ref": "#/definitions/groups"},
1011
"attributes": {"$ref": "#/definitions/attributes"},
1112
"datasets": {"$ref": "#/definitions/datasets"},
12-
"links": {"$ref": "#/definitions/links"}
13+
"links": {"$ref": "#/definitions/links"},
14+
"namespaces": {
15+
"type": "array",
16+
"items": {
17+
"type": "object",
18+
"additionalProperties": false,
19+
"required": [
20+
"name",
21+
"version",
22+
"author",
23+
"contact"
24+
],
25+
"properties": {
26+
"name": {"type": "string"},
27+
"version": {"type": "string", "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"},
28+
"doc": {"type": "string"},
29+
"author": {"type": "array", "items": {"type": "string"}},
30+
"contact": {"type": "array", "items": {"type": "string", "format": "email"}},
31+
"full_name": {"type": "string"},
32+
"date": {"type": "string", "format": "date"},
33+
"schema": {
34+
"type": "array",
35+
"items": {
36+
"type": "object",
37+
"oneOf": [
38+
{"required": ["namespace"]},
39+
{"required": ["source"]}
40+
],
41+
"properties": {
42+
"namespace": {"type": "string"},
43+
"doc": {"type": "string"},
44+
"source": {"type": "string"},
45+
"title": {"type": "string"},
46+
"neurodata_types": {
47+
"type": "array",
48+
"items": {
49+
"type": "string"
50+
}
51+
}
52+
}
53+
}
54+
}
55+
}
56+
}
57+
}
1358
},
1459
"definitions": {
1560
"protectedString": {
61+
"type": "string",
1662
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
1763
},
1864
"quantity": {
@@ -35,7 +81,7 @@
3581
}
3682
]
3783
},
38-
"dtype": {
84+
"flat_dtype": {
3985
"description": "Required string describing the data type of the attribute",
4086
"anyOf": [
4187
{
@@ -51,22 +97,28 @@
5197
"int32",
5298
"int16",
5399
"int8",
100+
"uint",
54101
"uint32",
55102
"uint16",
56103
"uint8",
104+
"uint64",
57105
"numeric",
58106
"text",
59107
"utf",
60108
"utf8",
61-
"unt-8",
109+
"utf-8",
62110
"ascii",
63111
"bool",
64112
"isodatetime"
65113
]
66114
},
67-
{
68-
"$ref": "#/definitions/ref_dtype"
69-
}
115+
{"$ref": "#/definitions/ref_dtype"}
116+
]
117+
},
118+
"dtype": {
119+
"anyOf": [
120+
{"$ref": "#/definitions/flat_dtype"},
121+
{"$ref": "#/definitions/compound_dtype"}
70122
]
71123
},
72124
"dims": {
@@ -107,6 +159,7 @@
107159
}
108160
},
109161
"ref_dtype": {
162+
"type": "object",
110163
"required": ["target_type", "reftype"],
111164
"properties": {
112165
"target_type": {
@@ -120,10 +173,23 @@
120173
}
121174
}
122175
},
176+
"compound_dtype": {
177+
"type": "array",
178+
"items": {
179+
"type": "object",
180+
"required": ["name", "doc", "dtype"],
181+
"properties": {
182+
"name": {"$ref": "#/definitions/protectedString"},
183+
"doc": {"type": "string"},
184+
"dtype": {"$ref": "#/definitions/flat_dtype"}
185+
}
186+
}
187+
},
123188
"groups": {
124189
"description": "list of groups",
125190
"type": "array",
126191
"items": {
192+
"title": "group",
127193
"type": "object",
128194
"required": ["doc"],
129195
"additionalProperties": false,
@@ -150,6 +216,7 @@
150216
"attributes": {
151217
"type": "array",
152218
"items": {
219+
"title": "attribute",
153220
"type": "object",
154221
"required": ["doc"],
155222
"additionalProperties": false,
@@ -168,6 +235,7 @@
168235
"links": {
169236
"type": "array",
170237
"items": {
238+
"title": "link",
171239
"type": "object",
172240
"required": ["target_type", "doc"],
173241
"additionalProperties": false,
@@ -182,6 +250,7 @@
182250
"datasets": {
183251
"type": "array",
184252
"items": {
253+
"title": "dataset",
185254
"type": "object",
186255
"required": ["doc"],
187256
"additionalProperties": false,

0 commit comments

Comments
 (0)