Skip to content

Commit e488e56

Browse files
authored
Simplify yaml schema (#264)
Avoid repetitions in yaml schema.
1 parent 4179d03 commit e488e56

File tree

2 files changed

+41
-55
lines changed

2 files changed

+41
-55
lines changed

petab/schemas/petab_schema.v1.0.0.yaml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1-
# For syntax see: https://json-schema.org/understanding-json-schema/index.html
1+
# For syntax see: https://json-schema.org/understanding-json-schema
22
#$schema: "https://json-schema.org/draft/2019-09/meta/core"
33
$schema: "http://json-schema.org/draft-06/schema"
44
description: PEtab parameter estimation problem config file schema
55

6+
definitions:
7+
list_of_files:
8+
type: array
9+
description: List of files.
10+
items:
11+
type: string
12+
description: File name or URL.
13+
version_number:
14+
type: string
15+
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]*))?$
16+
description: Version number (corresponding to PEP 440).
17+
618
properties:
719

820
format_version:
9-
type: integer
21+
anyof:
22+
- $ref: "#/definitions/version_number"
23+
- type: integer
1024
description: Version of the PEtab format (e.g. 1).
1125

1226
parameter_file:
@@ -35,45 +49,25 @@ properties:
3549
properties:
3650

3751
sbml_files:
38-
type: array
39-
description: List of PEtab SBML files.
40-
41-
items:
42-
type: string
43-
description: PEtab SBML file name or URL.
52+
$ref: "#/definitions/list_of_files"
53+
description: List of SBML model files.
4454

4555
measurement_files:
46-
type: array
56+
$ref: "#/definitions/list_of_files"
4757
description: List of PEtab measurement files.
4858

49-
items:
50-
type: string
51-
description: PEtab measurement file name or URL.
52-
5359
condition_files:
54-
type: array
60+
$ref: "#/definitions/list_of_files"
5561
description: List of PEtab condition files.
5662

57-
items:
58-
type: string
59-
description: PEtab condition file name or URL.
60-
6163
observable_files:
62-
type: array
64+
$ref: "#/definitions/list_of_files"
6365
description: List of PEtab observable files.
6466

65-
items:
66-
type: string
67-
description: PEtab observable file name or URL.
68-
6967
visualization_files:
70-
type: array
68+
$ref: "#/definitions/list_of_files"
7169
description: List of PEtab visualization files.
7270

73-
items:
74-
type: string
75-
description: PEtab visualization file name or URL.
76-
7771
required:
7872
- sbml_files
7973
- observable_files

petab/schemas/petab_schema.v2.0.0.yaml

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
# For syntax see: https://json-schema.org/understanding-json-schema/index.html
1+
# For syntax see: https://json-schema.org/understanding-json-schema
22
#$schema: "https://json-schema.org/draft/2019-09/meta/core"
33
$schema: "http://json-schema.org/draft-06/schema"
44
description: PEtab parameter estimation problem config file schema
55

6+
definitions:
7+
list_of_files:
8+
type: array
9+
description: List of files.
10+
items:
11+
type: string
12+
description: File name or URL.
13+
version_number:
14+
type: string
15+
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]*))?$
16+
description: Version number (corresponding to PEP 440).
17+
618
properties:
719

820
format_version:
921
anyof:
10-
- type: string
11-
# (corresponding to PEP 440).
12-
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]*))?$
22+
- $ref: "#/definitions/version_number"
1323
- type: integer
14-
1524
description: Version of the PEtab format
1625

1726
parameter_file:
@@ -60,36 +69,20 @@ properties:
6069
additionalProperties: false
6170

6271
measurement_files:
63-
type: array
6472
description: List of PEtab measurement files.
65-
66-
items:
67-
type: string
68-
description: PEtab measurement file name or URL.
73+
$ref: "#/definitions/list_of_files"
6974

7075
condition_files:
71-
type: array
7276
description: List of PEtab condition files.
73-
74-
items:
75-
type: string
76-
description: PEtab condition file name or URL.
77+
$ref: "#/definitions/list_of_files"
7778

7879
observable_files:
79-
type: array
8080
description: List of PEtab observable files.
81-
82-
items:
83-
type: string
84-
description: PEtab observable file name or URL.
81+
$ref: "#/definitions/list_of_files"
8582

8683
visualization_files:
87-
type: array
8884
description: List of PEtab visualization files.
89-
90-
items:
91-
type: string
92-
description: PEtab visualization file name or URL.
85+
$ref: "#/definitions/list_of_files"
9386

9487
mapping_file:
9588
type: string
@@ -113,8 +106,7 @@ properties:
113106
Information on a specific extension
114107
properties:
115108
version:
116-
type: string
117-
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]*))?$
109+
$ref: "#/definitions/version_number"
118110

119111
required:
120112
- version

0 commit comments

Comments
 (0)