Skip to content

Commit

Permalink
added enum choices to DataKey
Browse files Browse the repository at this point in the history
Also made each field in `LimitsRange` optional.
  • Loading branch information
evalott100 committed Sep 23, 2024
1 parent 72e40cd commit 49a4ab1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
9 changes: 6 additions & 3 deletions event_model/documents/event_descriptor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List
from typing import Any, Dict, List, Optional

from typing_extensions import Annotated, Literal, NotRequired, TypedDict

Expand All @@ -8,8 +8,8 @@


class LimitsRange(TypedDict):
low: float
high: float
low: Optional[float]
high: Optional[float]


class Limits(TypedDict):
Expand All @@ -28,6 +28,9 @@ class DataKey(TypedDict):
"""Describes the objects in the data property of Event documents"""

limits: NotRequired[Annotated[Limits, Field(description="Epics limits.")]]
choices: NotRequired[
Annotated[List[str], Field(description="Choices of enum value.")]
]
dims: NotRequired[
Annotated[
List[str],
Expand Down
26 changes: 24 additions & 2 deletions event_model/schemas/event_descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
"description": "Describes the objects in the data property of Event documents",
"type": "object",
"properties": {
"choices": {
"title": "Choices",
"description": "Choices of enum value.",
"type": "array",
"items": {
"type": "string"
}
},
"dims": {
"title": "Dims",
"description": "The names for dimensions of the data. Null or empty list if scalar data",
Expand Down Expand Up @@ -126,11 +134,25 @@
"properties": {
"high": {
"title": "High",
"type": "number"
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"low": {
"title": "Low",
"type": "number"
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down

0 comments on commit 49a4ab1

Please sign in to comment.