From a8b47acfa06897eb9fef8bfc3f7232b26acd0b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Tue, 18 Apr 2023 15:20:16 +0200 Subject: [PATCH] attribute_defs.toml --- share/openPMD/json_schema/attribute_defs.json | 15 +- share/openPMD/json_schema/attribute_defs.toml | 157 ++++++++++++++++++ 2 files changed, 161 insertions(+), 11 deletions(-) create mode 100644 share/openPMD/json_schema/attribute_defs.toml diff --git a/share/openPMD/json_schema/attribute_defs.json b/share/openPMD/json_schema/attribute_defs.json index 3a6c80aa63..ab89173601 100644 --- a/share/openPMD/json_schema/attribute_defs.json +++ b/share/openPMD/json_schema/attribute_defs.json @@ -180,17 +180,10 @@ "const": "ARR_DBL_7" }, "value": { - "any_of": [ - { - "type": "number" - }, - { - "type": "array", - "items": { - "type": "number" - } - } - ] + "type": "array", + "items": { + "type": "number" + } } } } diff --git a/share/openPMD/json_schema/attribute_defs.toml b/share/openPMD/json_schema/attribute_defs.toml new file mode 100644 index 0000000000..5bb757954d --- /dev/null +++ b/share/openPMD/json_schema/attribute_defs.toml @@ -0,0 +1,157 @@ + +["$defs"] + +###################### +# Vectors of strings # +###################### + +["$defs".vec_string_attribute.properties] + +value.any_of = [ + { type = "string" }, + { type = "array", items = { "type" = "string" } }, +] + +datatype.enum = [ + "STRING", + "CHAR", + "SCHAR", + "UCHAR", + "VEC_STRING", + "VEC_CHAR", + "VEC_SCHAR", + "VEC_UCHAR", +] + +################## +# Vectors of int # +################## + +["$defs".vec_int_attribute.properties] + +value.any_of = [ + { type = "integer" }, + { type = "array", items = { "type" = "integer" } }, +] + +datatype.enum = [ + "SHORT", + "INT", + "LONG", + "LONGLONG", + "USHORT", + "UINT", + "ULONG", + "ULONGLONG", + "VEC_SHORT", + "VEC_INT", + "VEC_LONG", + "VEC_LONGLONG", + "VEC_USHORT", + "VEC_UINT", + "VEC_ULONG", + "VEC_ULONGLONG", +] + +#################### +# Vectors of float # +#################### + +["$defs".vec_float_attribute.properties] + +value.any_of = [ + { type = "number" }, + { type = "array", items = { "type" = "number" } }, +] + +datatype.enum = [ + "SHORT", + "INT", + "LONG", + "LONGLONG", + "USHORT", + "UINT", + "ULONG", + "ULONGLONG", + "FLOAT", + "DOUBLE", + "LONG_DOUBLE", + "CFLOAT", + "CDOUBLE", + "CLONG_DOUBLE", + "VEC_SHORT", + "VEC_INT", + "VEC_LONG", + "VEC_LONGLONG", + "VEC_USHORT", + "VEC_UINT", + "VEC_ULONG", + "VEC_ULONGLONG", + "VEC_FLOAT", + "VEC_DOUBLE", + "VEC_LONG_DOUBLE", + "VEC_CFLOAT", + "VEC_CDOUBLE", + "VEC_CLONG_DOUBLE", +] + +########################### +# Special case: # +# unitDimension attribute # +########################### + +["$defs".unitDimension.properties] + +value = { type = "array", items = { type = "number" } } +datatype.const = "ARR_DBL_7" + +##################### +# string attributes # +##################### + +["$defs".string_attribute.properties] + +value.type = "string" +datatype.enum = ["STRING", "CHAR", "SCHAR", "UCHAR"] + +################## +# int attributes # +################## + +["$defs".int_attribute.properties] + +value.type = "integer" +datatype.enum = [ + "SHORT", + "INT", + "LONG", + "LONGLONG", + "USHORT", + "UINT", + "ULONG", + "ULONGLONG", +] + +#################### +# float attributes # +#################### + +["$defs".float_attribute.properties] + +value.type = "number" +datatype.enum = [ + "SHORT", + "INT", + "LONG", + "LONGLONG", + "USHORT", + "UINT", + "ULONG", + "ULONGLONG", + "FLOAT", + "DOUBLE", + "LONG_DOUBLE", + "CFLOAT", + "CDOUBLE", + "CLONG_DOUBLE", +]