fix(ocs): change /tasktypes response to combine optional and non-optional IO slots

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Marcel Klehr 2 weeks ago
parent bb90405891
commit 2a65b7851c

@ -83,10 +83,14 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
$serializedTaskTypes[$key] = [
'name' => $taskType['name'],
'description' => $taskType['description'],
'inputShape' => array_map(fn (ShapeDescriptor $descriptor) => $descriptor->jsonSerialize(), $taskType['inputShape']),
'optionalInputShape' => array_map(fn (ShapeDescriptor $descriptor) => $descriptor->jsonSerialize(), $taskType['optionalInputShape']),
'outputShape' => array_map(fn (ShapeDescriptor $descriptor) => $descriptor->jsonSerialize(), $taskType['outputShape']),
'optionalOutputShape' => array_map(fn (ShapeDescriptor $descriptor) => $descriptor->jsonSerialize(), $taskType['optionalOutputShape']),
'inputShape' => array_map(fn (ShapeDescriptor $descriptor) =>
$descriptor->jsonSerialize() + ['mandatory' => true], $taskType['inputShape'])
+ array_map(fn (ShapeDescriptor $descriptor) =>
$descriptor->jsonSerialize() + ['mandatory' => false], $taskType['optionalInputShape']),
'outputShape' => array_map(fn (ShapeDescriptor $descriptor) =>
$descriptor->jsonSerialize() + ['mandatory' => true], $taskType['outputShape'])
+ array_map(fn (ShapeDescriptor $descriptor) =>
$descriptor->jsonSerialize() + ['mandatory' => false], $taskType['optionalOutputShape']),
];
}

@ -180,16 +180,15 @@ namespace OCA\Core;
* @psalm-type CoreTaskProcessingShape = array{
* name: string,
* description: string,
* type: int
* type: int,
* mandatory: bool,
* }
*
* @psalm-type CoreTaskProcessingTaskType = array{
* name: string,
* description: string,
* inputShape: CoreTaskProcessingShape[],
* optionalInputShape: CoreTaskProcessingShape[],
* outputShape: CoreTaskProcessingShape[],
* optionalOutputShape: CoreTaskProcessingShape[],
* }
*
* @psalm-type CoreTaskProcessingTask = array{

@ -471,7 +471,8 @@
"required": [
"name",
"description",
"type"
"type",
"mandatory"
],
"properties": {
"name": {
@ -483,6 +484,9 @@
"type": {
"type": "integer",
"format": "int64"
},
"mandatory": {
"type": "boolean"
}
}
},
@ -599,9 +603,7 @@
"name",
"description",
"inputShape",
"optionalInputShape",
"outputShape",
"optionalOutputShape"
"outputShape"
],
"properties": {
"name": {
@ -616,23 +618,11 @@
"$ref": "#/components/schemas/TaskProcessingShape"
}
},
"optionalInputShape": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TaskProcessingShape"
}
},
"outputShape": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TaskProcessingShape"
}
},
"optionalOutputShape": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TaskProcessingShape"
}
}
}
},

Loading…
Cancel
Save