Skip to content

Commit 4e9c710

Browse files
committed
Translate all of this to TOML
1 parent 07acb94 commit 4e9c710

7 files changed

Lines changed: 231 additions & 6 deletions

File tree

share/openPMD/json_schema/mesh.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@
6363
},
6464
{
6565
"title": "Contains components",
66-
"description": "Additionally to the attributes, at least one component must be contained",
6766
"oneOf": [
6867
{
6968
"title": "Scalar mesh component",
7069
"$ref": "mesh_record_component.json"
7170
},
7271
{
7372
"title": "Vector component",
73+
"description": "Additionally to the attributes, at least one component must be contained",
7474
"patternProperties":
7575
{
7676
"^(?!attributes).*": {

share/openPMD/json_schema/mesh.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dataOrder."$ref" = "attribute_defs.json#/$defs/string_attribute"
4343
axisLabels."$ref" = "attribute_defs.json#/$defs/vec_string_attribute"
4444

4545
################################################
46-
# Requirement 1.1: Generic attribute structure #
46+
# Requirement 1.2: Generic attribute structure #
4747
################################################
4848

4949
[[allOf.properties.attributes.allOf]]
@@ -57,7 +57,6 @@ title = "Attribute layout"
5757
[[allOf]]
5858

5959
title = "Contains components"
60-
description = "Additionally to the attributes, at least one component must be contained"
6160

6261
####################################################
6362
# Requirement 2.1: Either this is a scalar mesh... #
@@ -68,13 +67,14 @@ title = "Scalar mesh component"
6867
"$ref" = "mesh_record_component.json"
6968

7069
#################################################
71-
# Requirement 2.1: ... or it's a vector mesh. #
70+
# Requirement 2.2: ... or it's a vector mesh. #
7271
# Note that exactly one of these two conditions #
7372
# must be true, not both at once (oneOf). #
7473
#################################################
7574

7675
[[allOf.oneOf]]
7776
title = "Vector component"
77+
description = "Additionally to the attributes, at least one component must be contained"
7878
# The attributes are contained in this dict, and at least one further
7979
# non-scalar component. Hence, we require at least two entries.
8080
minProperties = 2
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
title = "Mesh Record Component"
2+
3+
#############################################
4+
# Requirement 1: This is a record component #
5+
#############################################
6+
7+
[[allOf]]
8+
title = "Record Component"
9+
"$ref" = "record_component.json"
10+
11+
##################################################
12+
# Requirement 2: Mesh Record Component Specifics #
13+
##################################################
14+
15+
[[allOf]]
16+
title = "Mesh Record Component"
17+
description = "Single component in a mesh record."
18+
type = "object"
19+
required = ["attributes"]
20+
21+
[allOf.properties.attributes]
22+
required = ["position"]
23+
title = "Record Component attributes"
24+
description = "Standard-defined attributes at the Record Component level."
25+
26+
[allOf.properties.attributes.properties]
27+
position."$ref" = "attribute_defs.json#/$defs/vec_float_attribute"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
type = "object"
2+
title = "Particle Species"
3+
description = "Dict of particle quantities."
4+
propertyNames.pattern = "^\\w*$"
5+
6+
[properties.attributes]
7+
8+
##################################################
9+
# First requirement: standard-defined attributes #
10+
##################################################
11+
12+
[[properties.attributes.allOf]]
13+
title = "Particle Species attributes"
14+
description = "Standard-defined attributes at the Particle Species level."
15+
# No required attributes
16+
required = []
17+
18+
[properties.attributes.allOf.properties]
19+
id."$ref" = "attribute_defs.json#/$defs/int_attribute"
20+
21+
####################################################
22+
# Second requirement: General layout of attributes #
23+
####################################################
24+
25+
[[properties.attributes.allOf]]
26+
title = "Attribute layout"
27+
description = "Custom attributes allowed, no required attributes defined."
28+
"$ref" = "attributes.json"
29+
30+
31+
[patternProperties."^(?!(attributes|particlePatches)).*"]
32+
title = "Record"
33+
"$ref" = "record.json"
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#########################################################
2+
# Requirement 1: Mesh-specific structure and attributes #
3+
#########################################################
4+
5+
[[allOf]]
6+
7+
type = "object"
8+
required = ["attributes"]
9+
title = "Record"
10+
description = "A list of particle quantities."
11+
12+
[allOf.properties.attributes]
13+
title = "Attributes"
14+
15+
####################################
16+
# Requirement 1.1: Mesh attributes #
17+
####################################
18+
19+
[[allOf.properties.attributes.allOf]]
20+
21+
title = "Particle Record attributes"
22+
description = "Standard-defined attributes at the Particle Record level."
23+
required = ["timeOffset", "unitDimension"]
24+
25+
[allOf.properties.attributes.allOf.properties]
26+
27+
timeOffset."$ref" = "attribute_defs.json#/$defs/float_attribute"
28+
unitDimension."$ref" = "attribute_defs.json#/$defs/unitDimension"
29+
dataOrder."$ref" = "attribute_defs.json#/$defs/string_attribute"
30+
31+
################################################
32+
# Requirement 1.2: Generic attribute structure #
33+
################################################
34+
35+
[[allOf.properties.attributes.allOf]]
36+
title = "Attribute layout"
37+
"$ref" = "attributes.json"
38+
39+
######################################
40+
# Requirement 2: Contains components #
41+
######################################
42+
43+
[[allOf]]
44+
title = "Contains components"
45+
46+
####################################################
47+
# Requirement 2.1: Either this is a scalar mesh... #
48+
####################################################
49+
50+
[[allOf.oneOf]]
51+
title = "Scalar component"
52+
"$ref" = "record_component.json"
53+
54+
#################################################
55+
# Requirement 2.2: ... or it's a vector mesh. #
56+
# Note that exactly one of these two conditions #
57+
# must be true, not both at once (oneOf). #
58+
#################################################
59+
60+
[[allOf.oneOf]]
61+
title = "Vector component"
62+
description = "Additionally to the attributes, at least one component must be contained"
63+
# The attributes are contained in this dict, and at least one further
64+
# non-scalar component. Hence, we require at least two entries.
65+
minProperties = 2
66+
propertyNames.pattern = "^\\w*$"
67+
68+
[allOf.oneOf.patternProperties]
69+
70+
[allOf.oneOf.patternProperties."^(?!attributes).*"]
71+
title = "Scalar component"
72+
"$ref" = "record_component.json"
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
##############################################
2+
# Requirement 1: Record Component attributes #
3+
##############################################
4+
5+
[[allOf]]
6+
title = "Record Component"
7+
description = "Single component in a record."
8+
type = "object"
9+
required = ["attributes"]
10+
11+
[allOf.properties.attributes]
12+
title = "Attributes"
13+
14+
################################################
15+
# Requirement 1.1: Standard-defined attributes #
16+
################################################
17+
18+
[[allOf.properties.attributes.allOf]]
19+
title = "Record Component attributes"
20+
description = "Standard-defined attributes at the Record Component level."
21+
required = ["unitSI"]
22+
23+
[allOf.properties.attributes.allOf.properties]
24+
unitSI."$ref" = "attribute_defs.json#/$defs/float_attribute"
25+
26+
#############################################
27+
# Requirement 1.2: Generic attribute layout #
28+
#############################################
29+
30+
[[allOf.properties.attributes.allOf]]
31+
title = "Attribute layout"
32+
"$ref" = "attributes.json"
33+
34+
###########################################
35+
# Requirement 2: Either array or constant #
36+
###########################################
37+
38+
[[allOf]]
39+
title = "Either array or constant"
40+
41+
#####################
42+
# Option 2.1: Array #
43+
#####################
44+
45+
[[allOf.oneOf]]
46+
required = ["data", "datatype"]
47+
description = "An n-dimensional dataset containing the payload."
48+
title = "Array dataset"
49+
50+
[allOf.oneOf.properties]
51+
52+
datatype.enum = [
53+
"CHAR",
54+
"UCHAR",
55+
"SCHAR",
56+
"SHORT",
57+
"INT",
58+
"LONG",
59+
"LONGLONG",
60+
"USHORT",
61+
"UINT",
62+
"ULONG",
63+
"ULONGLONG",
64+
"FLOAT",
65+
"DOUBLE",
66+
"LONG_DOUBLE",
67+
"CFLOAT",
68+
"CDOUBLE",
69+
"CLONG_DOUBLE",
70+
"BOOL",
71+
]
72+
# TODO: properly define this
73+
data.type = "array"
74+
75+
########################
76+
# Option 2.2: Constant #
77+
########################
78+
79+
[[allOf.oneOf]]
80+
title = "Constant dataset"
81+
description = "A dataset represented by two attributes: The constant value and its shape."
82+
required = ["attributes"]
83+
84+
[allOf.oneOf.properties.attributes]
85+
required = ["shape", "value"]
86+
87+
[allOf.oneOf.properties.attributes.properties]
88+
value."$ref" = "attribute_defs.json#/$defs/float_attribute"
89+
shape."$ref" = "attribute_defs.json#/$defs/vec_int_attribute"

share/openPMD/json_schema/series.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ title = "Iteration"
4040
[properties.attributes]
4141
title = "Attributes"
4242

43-
# First requirement: standard-defined attributes
43+
##############################################
44+
# Requirement 1: standard-defined attributes #
45+
##############################################
4446

4547
[[properties.attributes.allOf]]
4648
required = ["openPMD", "openPMDextension", "basePath"]
@@ -70,7 +72,9 @@ particlesPath.description = "Note that the particlesPath is hardcoded as its sem
7072
particlesPath.const.value = "particles/"
7173
particlesPath.const.datatype = "STRING"
7274

73-
# Second condition: General layout of attributes
75+
###############################################
76+
# Requirement 2: General layout of attributes #
77+
###############################################
7478

7579
[[properties.attributes.allOf]]
7680
title = "Attribute layout"

0 commit comments

Comments
 (0)