diff --git a/Dockerfile-domino-piece.dev b/Dockerfile-domino-piece.dev index bec67a3d..7bc8ff03 100644 --- a/Dockerfile-domino-piece.dev +++ b/Dockerfile-domino-piece.dev @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.10-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 diff --git a/Dockerfile-domino-piece.prod b/Dockerfile-domino-piece.prod index 3c1992c0..50210914 100644 --- a/Dockerfile-domino-piece.prod +++ b/Dockerfile-domino-piece.prod @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.10-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 diff --git a/frontend/src/@types/piece/piece.d.ts b/frontend/src/@types/piece/piece.d.ts index e3f404f8..cbdddb72 100644 --- a/frontend/src/@types/piece/piece.d.ts +++ b/frontend/src/@types/piece/piece.d.ts @@ -34,7 +34,7 @@ export interface PieceSchema { type: "object"; properties: SchemaProperties; - definitions: Definitions; + $defs: Definitions; } export interface Piece { diff --git a/frontend/src/@types/piece/properties.d.ts b/frontend/src/@types/piece/properties.d.ts index 38637624..300beeb3 100644 --- a/frontend/src/@types/piece/properties.d.ts +++ b/frontend/src/@types/piece/properties.d.ts @@ -1,5 +1,5 @@ interface Reference { - $ref: `#/definitions/${string}`; + $ref: `#/$defs/${string}`; } type FromUpstream = "always" | "never" | "allowed"; diff --git a/frontend/src/features/workflowEditor/components/DrawerMenu/pieceDocsPopover.tsx b/frontend/src/features/workflowEditor/components/DrawerMenu/pieceDocsPopover.tsx index 2017bb86..8ab9cd02 100644 --- a/frontend/src/features/workflowEditor/components/DrawerMenu/pieceDocsPopover.tsx +++ b/frontend/src/features/workflowEditor/components/DrawerMenu/pieceDocsPopover.tsx @@ -18,7 +18,7 @@ function renderPieceProperties( if ("allOf" in argument && argument.allOf.length > 0) { typeName = "enum"; const typeClass = argument.allOf[0].$ref.split("/").pop() as string; - valuesOptions = (schema?.definitions?.[typeClass] as EnumDefinition).enum; + valuesOptions = (schema?.$defs?.[typeClass] as EnumDefinition).enum; } return ( diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/index.tsx b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/index.tsx index 4ab53ed6..63f4076f 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/index.tsx +++ b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/index.tsx @@ -58,7 +58,7 @@ const PieceForm: React.FC = ({ formId, schema }) => { schema={schema.properties[key]} itemKey={key} control={control} - definitions={schema?.definitions} + definitions={schema?.$defs} upstreamOptions={upstreamOptions[key] ?? []} /> diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/upstreamOptions.ts b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/upstreamOptions.ts index 783bdecc..d5c0ddc4 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/upstreamOptions.ts +++ b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/upstreamOptions.ts @@ -1,3 +1,4 @@ +import { useCallback } from "react"; import { generateTaskName, getUuidSlice } from "utils"; export interface Option { @@ -22,12 +23,27 @@ const getInputType = (schema: Record) => { } else if ("anyOf" in schema) { type = []; for (const item of schema.anyOf) { - type.push(item.type); + let _type = item.type; + _type = _type === "number" ? "float" : (_type as string); + type.push(_type); } } return type === "number" ? "float" : (type as string); }; +const validateUpstreamType = (upType: string, type: string) => { + if (upType === type) { + return true; + } + if (Array.isArray(upType) && !Array.isArray(type)) { + return upType.includes(type); + } + if (Array.isArray(upType) && Array.isArray(type)) { + return upType.some((element) => type.includes(element)); + } + return false; +}; + const getOptions = ( upstreamPieces: Record, type: string, @@ -43,11 +59,7 @@ const getOptions = ( for (const property in upSchema) { const upType = getInputType(upSchema[property]); - if ( - upType === type || - (upType === "string" && type === "object") || - (Array.isArray(type) && type.includes(upType)) - ) { + if (validateUpstreamType(upType, type)) { const value = `${upPiece?.name} (${getUuidSlice(upPiece.id)}) - ${ upSchema[property].title }`; @@ -96,7 +108,7 @@ export const getUpstreamOptions = ( let itemsSchema = currentSchema?.items; if (currentSchema?.items?.$ref) { const subItemSchemaName = currentSchema.items.$ref.split("/").pop(); - itemsSchema = schema.definitions?.[subItemSchemaName]; + itemsSchema = schema.$defs?.[subItemSchemaName]; } const array = getOptions(upstreamPieces, currentType); diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts index 264be0e5..9d8bdb9b 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts +++ b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts @@ -189,7 +189,7 @@ export function createInputsSchemaValidation(schema: any) { let subItemSchema: any = subSchema?.items; if (subSchema?.items?.$ref) { const subItemSchemaName = subSchema.items.$ref.split("/").pop(); - subItemSchema = schema.definitions?.[subItemSchemaName]; + subItemSchema = schema.$defs?.[subItemSchemaName]; } const required = true; // for arrays, we always require the value inputSchema = yup.object({ diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/index.tsx b/frontend/src/features/workflowEditor/components/SidebarForm/index.tsx index dae41c48..9a0e47f5 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/index.tsx +++ b/frontend/src/features/workflowEditor/components/SidebarForm/index.tsx @@ -78,7 +78,7 @@ const SidebarPieceForm: React.FC = (props) => { return ( "items" in inputSchema && "$ref" in inputSchema.items && - inputSchema.items.$ref === "#/definitions/OutputModifierModel" + inputSchema.items.$ref === "#/$defs/OutputModifierModel" ); }, ); @@ -173,7 +173,7 @@ const SidebarPieceForm: React.FC = (props) => { minWidth: "300px", }, }} - BackdropProps={{ style: { backgroundColor: "transparent" } }} + slotProps={{ backdrop: { style: { backgroundColor: "transparent" } } }} >
{ const schema = pieceSchema.input_schema.properties; - const definitions = pieceSchema.input_schema.definitions; + const definitions = pieceSchema.input_schema.$defs; const defaultData = extractDefaultValues(pieceSchema.input_schema); const defaultInputs: IWorkflowPieceData["inputs"] = {}; diff --git a/pyproject.toml b/pyproject.toml index 16f7c96b..69f29a4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dependencies = [ "PyYAML==6.0.1", "jsonschema==4.18.0", "click==8.1.3", - "rich==12.6.0", + "rich>=13.4.2", "colorama==0.4.6", ] diff --git a/src/domino/VERSION b/src/domino/VERSION index 09a3acfa..7ceb0404 100644 --- a/src/domino/VERSION +++ b/src/domino/VERSION @@ -1 +1 @@ -0.6.0 \ No newline at end of file +0.6.1 \ No newline at end of file