diff --git a/event_model/documents/event_descriptor.py b/event_model/documents/event_descriptor.py index 3fa799a9..2edb99eb 100644 --- a/event_model/documents/event_descriptor.py +++ b/event_model/documents/event_descriptor.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List from typing_extensions import Annotated, Literal, NotRequired, TypedDict @@ -41,7 +41,7 @@ class DataKey(TypedDict): ] precision: NotRequired[ Annotated[ - Optional[int], + int, Field( description="Number of digits after decimal place if " "a floating point number" @@ -56,7 +56,7 @@ class DataKey(TypedDict): str, Field(description="The source (ex piece of hardware) of the data.") ] units: NotRequired[ - Annotated[Optional[str], Field(description="Engineering units of the value")] + Annotated[str, Field(description="Engineering units of the value")] ] diff --git a/event_model/schemas/datum_page.json b/event_model/schemas/datum_page.json index a09dc59f..7d34f988 100644 --- a/event_model/schemas/datum_page.json +++ b/event_model/schemas/datum_page.json @@ -14,11 +14,7 @@ "properties": { "datum_id": { "description": "Array unique identifiers for each Datum (akin to 'uid' for other Document types), typically formatted as '/'", - "allOf": [ - { - "$ref": "#/$defs/DataFrameForDatumPage" - } - ] + "$ref": "#/$defs/DataFrameForDatumPage" }, "datum_kwargs": { "title": "Datum Kwargs", diff --git a/event_model/schemas/event_descriptor.json b/event_model/schemas/event_descriptor.json index 3549af5f..0c1bf012 100644 --- a/event_model/schemas/event_descriptor.json +++ b/event_model/schemas/event_descriptor.json @@ -66,14 +66,7 @@ "precision": { "title": "Precision", "description": "Number of digits after decimal place if a floating point number", - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ] + "type": "integer" }, "shape": { "title": "Shape", @@ -91,14 +84,7 @@ "units": { "title": "Units", "description": "Engineering units of the value", - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" } }, "required": [ diff --git a/event_model/schemas/event_page.json b/event_model/schemas/event_page.json index 55cf9c23..7c987427 100644 --- a/event_model/schemas/event_page.json +++ b/event_model/schemas/event_page.json @@ -32,11 +32,7 @@ "properties": { "data": { "description": "The actual measurement data", - "allOf": [ - { - "$ref": "#/$defs/DataFrameForEventPage" - } - ] + "$ref": "#/$defs/DataFrameForEventPage" }, "descriptor": { "title": "Descriptor", @@ -45,11 +41,7 @@ }, "filled": { "description": "Mapping each of the keys of externally-stored data to an array containing the boolean False, indicating that the data has not been loaded, or to foreign keys (moved here from 'data' when the data was loaded)", - "allOf": [ - { - "$ref": "#/$defs/DataFrameForFilled" - } - ] + "$ref": "#/$defs/DataFrameForFilled" }, "seq_num": { "title": "Seq Num", @@ -69,11 +61,7 @@ }, "timestamps": { "description": "The timestamps of the individual measurement data", - "allOf": [ - { - "$ref": "#/$defs/DataFrameForEventPage" - } - ] + "$ref": "#/$defs/DataFrameForEventPage" }, "uid": { "title": "Uid", diff --git a/event_model/schemas/run_start.json b/event_model/schemas/run_start.json index e7c019f1..852e44b1 100644 --- a/event_model/schemas/run_start.json +++ b/event_model/schemas/run_start.json @@ -72,11 +72,7 @@ "calculation": { "title": "calculation properties", "description": "required fields if type is calculated", - "allOf": [ - { - "$ref": "#/$defs/Calculation" - } - ] + "$ref": "#/$defs/Calculation" }, "config_device": { "title": "Config Device", @@ -289,11 +285,7 @@ }, "data_type": { "description": "", - "allOf": [ - { - "$ref": "#/$defs/DataType" - } - ] + "$ref": "#/$defs/DataType" }, "group": { "title": "Group", diff --git a/event_model/schemas/run_stop.json b/event_model/schemas/run_stop.json index 89f51815..b0d64458 100644 --- a/event_model/schemas/run_stop.json +++ b/event_model/schemas/run_stop.json @@ -10,11 +10,7 @@ "properties": { "data_type": { "description": "data_type", - "allOf": [ - { - "$ref": "#/$defs/DataType" - } - ] + "$ref": "#/$defs/DataType" }, "exit_status": { "title": "Exit Status", diff --git a/event_model/schemas/stream_datum.json b/event_model/schemas/stream_datum.json index d5217f39..75b53ed7 100644 --- a/event_model/schemas/stream_datum.json +++ b/event_model/schemas/stream_datum.json @@ -33,19 +33,11 @@ }, "indices": { "description": "A slice object passed to the StreamResource handler so it can hand back data and timestamps", - "allOf": [ - { - "$ref": "#/$defs/StreamRange" - } - ] + "$ref": "#/$defs/StreamRange" }, "seq_nums": { "description": "A slice object showing the Event numbers the resource corresponds to", - "allOf": [ - { - "$ref": "#/$defs/StreamRange" - } - ] + "$ref": "#/$defs/StreamRange" }, "stream_resource": { "title": "Stream Resource", diff --git a/event_model/tests/test_em.py b/event_model/tests/test_em.py index 15e0fd81..015072f2 100644 --- a/event_model/tests/test_em.py +++ b/event_model/tests/test_em.py @@ -56,7 +56,7 @@ def test_compose_run(): assert bundle.compose_stop is compose_stop bundle = compose_descriptor( data_keys={ - "motor": {"shape": [], "dtype": "number", "source": "...", "units": None}, + "motor": {"shape": [], "dtype": "number", "source": "...", "units": "s"}, "image": { "shape": [512, 512], "dtype": "number",