Skip to content

Commit

Permalink
inputs can be none, too
Browse files Browse the repository at this point in the history
  • Loading branch information
swelborn committed Feb 11, 2025
1 parent b7a44b1 commit b2c89af
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion backend/core/interactem/core/models/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ class Operator(BaseModel):
label: str # Human readable name of the operator
description: str # Human readable description of the operator
image: str # Contain image for operator
inputs: list[OperatorInput] = None # List of inputs
inputs: list[OperatorInput] | None = None # List of inputs
outputs: list[OperatorOutput] | None = None # List of outputs
parameters: list[OperatorParameter] | None = None # List of parameters
9 changes: 7 additions & 2 deletions frontend/interactEM/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,13 @@
"description": { "type": "string", "title": "Description" },
"image": { "type": "string", "title": "Image" },
"inputs": {
"items": { "$ref": "#/components/schemas/OperatorInput" },
"type": "array",
"anyOf": [
{
"items": { "$ref": "#/components/schemas/OperatorInput" },
"type": "array"
},
{ "type": "null" }
],
"title": "Inputs"
},
"outputs": {
Expand Down
2 changes: 1 addition & 1 deletion frontend/interactEM/src/client/generated/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type Operator = {
label: string
description: string
image: string
inputs?: Array<OperatorInput>
inputs?: Array<OperatorInput> | null
outputs?: Array<OperatorOutput> | null
parameters?: Array<OperatorParameter> | null
}
Expand Down
15 changes: 9 additions & 6 deletions frontend/interactEM/src/client/generated/zod.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ export const zOperator = z.object({
description: z.string(),
image: z.string(),
inputs: z
.array(
z.object({
label: z.string(),
description: z.string(),
}),
)
.union([
z.array(
z.object({
label: z.string(),
description: z.string(),
}),
),
z.null(),
])
.optional(),
outputs: z
.union([
Expand Down

0 comments on commit b2c89af

Please sign in to comment.