Skip to content

Commit 388257e

Browse files
niklubnikrobot-ci-heartexfern-api[bot]nikitabelonogov
authored
feat: DIA-1969: Support MIG Image use case (#423)
Co-authored-by: nik <[email protected]> Co-authored-by: robot-ci-heartex <[email protected]> Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Nikita Belonogov <[email protected]> Co-authored-by: pakelley <[email protected]>
1 parent bc777b2 commit 388257e

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

src/label_studio_sdk/label_interface/control_tags.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -992,8 +992,14 @@ def to_json_schema(self):
992992
dict: A dictionary representing the JSON Schema compatible with OpenAPI 3.
993993
"""
994994
return {
995-
"type": "string",
996-
"description": f"List of texts (one or more) for {self.to_name[0]}"
995+
"oneOf": [
996+
{"type": "string"},
997+
{
998+
"type": "array",
999+
"items": {"type": "string"}
1000+
}
1001+
],
1002+
"description": f"Text or list of texts for {self.to_name[0]}"
9971003
}
9981004

9991005

src/label_studio_sdk/label_interface/object_tags.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ def parse_node(cls, tag: xml.etree.ElementTree.Element, tags_mapping=None) -> "O
119119
tag=tag.tag,
120120
attr=dict(tag.attrib),
121121
name=tag.attrib.get("name"),
122-
value=tag.attrib["value"],
122+
value=tag.attrib.get('valueList', tag.attrib.get('value')),
123123
)
124124

125125
@classmethod
126126
def validate_node(cls, tag: xml.etree.ElementTree.Element) -> bool:
127127
"""
128128
Check if tag is input
129129
"""
130-
return bool(tag.attrib.get("name") and tag.attrib.get("value"))
130+
return bool(tag.attrib.get("name") and (tag.attrib.get("value") or tag.attrib.get("valueList")))
131131

132132
@property
133133
def value_type(self):

tests/custom/test_interface/test_json_schema.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,14 @@
143143
"enum": ["Positive", "Negative", "Neutral"],
144144
},
145145
"reasoning": {
146-
"type": "string",
147-
"description": "List of texts (one or more) for document"
146+
"oneOf": [
147+
{"type": "string"},
148+
{
149+
"type": "array",
150+
"items": {"type": "string"}
151+
}
152+
],
153+
"description": "Text or list of texts for document"
148154
}
149155
},
150156
"required": []
@@ -242,8 +248,14 @@
242248
"enum": ["Positive", "Negative", "Neutral"],
243249
},
244250
"reasoning": {
245-
"type": "string",
246-
"description": "List of texts (one or more) for document"
251+
"oneOf": [
252+
{"type": "string"},
253+
{
254+
"type": "array",
255+
"items": {"type": "string"}
256+
}
257+
],
258+
"description": "Text or list of texts for document"
247259
}
248260
},
249261
"required": ["reasoning"]

0 commit comments

Comments
 (0)