Skip to content

Commit c167df3

Browse files
authored
Simplify PEtab v2 schema (#658)
Be less repetitive. And add pre-commit hook for schema validation.
1 parent 9bc942f commit c167df3

2 files changed

Lines changed: 42 additions & 50 deletions

File tree

.pre-commit-config.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v5.0.0
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v6.0.0
66
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- id: check-yaml
10-
- id: check-added-large-files
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
12+
- repo: https://github.com/python-jsonschema/check-jsonschema
13+
rev: 0.36.0
14+
hooks:
15+
- id: check-metaschema
16+
files: ^.*schema.*\.(yaml|json)$

doc/v2/_static/petab_schema_v2.yaml

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
# For syntax see: https://json-schema.org/understanding-json-schema
22
$schema: "https://json-schema.org/draft/2020-12/schema"
3-
description: PEtab parameter estimation problem config file schema
3+
description: PEtab 2.0 parameter estimation problem configuration schema.
4+
5+
definitions:
6+
list_of_files:
7+
type: array
8+
description: List of files.
9+
items:
10+
type: string
11+
description: |
12+
File name or URL, absolute or relative to the location of the PEtab
13+
problem configuration file.
14+
version_number:
15+
type: string
16+
pattern: ^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$
17+
description: Version number.
418

519
properties:
620

721
format_version:
822
anyOf:
9-
- type: string
10-
# (corresponding to PEP 440).
11-
pattern: ^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$
23+
- $ref: "#/definitions/version_number"
1224
- type: integer
13-
14-
description: Version of the PEtab format
25+
description: Version of the PEtab format.
1526

1627
id:
1728
type: string
@@ -22,18 +33,12 @@ properties:
2233
pattern: "^[a-zA-Z_]\\w*$"
2334

2435
parameter_files:
25-
type: array
26-
description: |
27-
List of PEtab parameter files.
28-
29-
items:
30-
type: string
31-
description: |
32-
File name (absolute or relative) or URL to a PEtab parameter table.
36+
description: List of PEtab parameter files.
37+
$ref: "#/definitions/list_of_files"
3338

3439
model_files:
3540
type: object
36-
description: One or multiple models
41+
description: One or multiple models.
3742

3843
# the model ID
3944
patternProperties:
@@ -42,7 +47,9 @@ properties:
4247
properties:
4348
location:
4449
type: string
45-
description: Model file name or URL
50+
description: |
51+
Model file name or URL, absolute or relative to the location of
52+
the PEtab problem configuration file.
4653
language:
4754
type: string
4855
description: |
@@ -53,44 +60,24 @@ properties:
5360
additionalProperties: false
5461

5562
measurement_files:
56-
type: array
5763
description: List of PEtab measurement files.
58-
59-
items:
60-
type: string
61-
description: PEtab measurement file name or URL.
64+
$ref: "#/definitions/list_of_files"
6265

6366
condition_files:
64-
type: array
6567
description: List of PEtab condition files.
66-
67-
items:
68-
type: string
69-
description: PEtab condition file name or URL.
68+
$ref: "#/definitions/list_of_files"
7069

7170
experiment_files:
72-
type: array
73-
description: List of PEtab experiment files
74-
75-
items:
76-
type: string
77-
description: PEtab experiment file name or URL.
71+
description: List of PEtab experiment files.
72+
$ref: "#/definitions/list_of_files"
7873

7974
observable_files:
80-
type: array
8175
description: List of PEtab observable files.
82-
83-
items:
84-
type: string
85-
description: PEtab observable file name or URL.
76+
$ref: "#/definitions/list_of_files"
8677

8778
mapping_files:
88-
type: array
8979
description: List of PEtab mapping files.
90-
91-
items:
92-
type: string
93-
description: PEtab mapping file name or URL.
80+
$ref: "#/definitions/list_of_files"
9481

9582
extensions:
9683
type: object
@@ -104,8 +91,7 @@ properties:
10491
Information on a specific extension
10592
properties:
10693
version:
107-
type: string
108-
pattern: ^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$
94+
$ref: "#/definitions/version_number"
10995
required:
11096
type: boolean
11197
description: |

0 commit comments

Comments
 (0)