From bb81d5e01970d909794b8b57d5a2f94ecdcc407d Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 30 Jul 2022 17:30:34 +0200 Subject: [PATCH] split openapi & openflow --- backend/openapi.yaml | 220 +++++----------------------------- backend/openflow.openapi.yaml | 153 +++++++++++++++++++++++ 2 files changed, 185 insertions(+), 188 deletions(-) create mode 100644 backend/openflow.openapi.yaml diff --git a/backend/openapi.yaml b/backend/openapi.yaml index 8cbb56e3dd..2e6700f77d 100644 --- a/backend/openapi.yaml +++ b/backend/openapi.yaml @@ -1601,7 +1601,7 @@ paths: type: object properties: flow: - $ref: "#/components/schemas/OpenFlow" + $ref: "openflow.openapi.yaml#/components/schemas/OpenFlow" /scripts/hub/get/{path}: get: @@ -2087,24 +2087,15 @@ paths: content: application/json: schema: - type: object - properties: - path: - type: string - summary: - type: string - description: - type: string - value: - $ref: "#/components/schemas/FlowValue" - schema: - type: object - required: - - path - - summary - - description - - content - - value + allOf: + - $ref: "openflow.openapi.yaml#/components/schemas/OpenFlow" + - type: object + properties: + path: + type: string + required: + - path + responses: "201": description: flow created @@ -2128,24 +2119,15 @@ paths: content: application/json: schema: - type: object - properties: - path: - type: string - summary: - type: string - description: - type: string - value: - $ref: "#/components/schemas/FlowValue" - schema: - type: object - required: - - path - - summary - - description - - content - - value + allOf: + - $ref: "openflow.openapi.yaml#/components/schemas/OpenFlow" + - type: object + properties: + path: + type: string + required: + - path + responses: "200": description: flow updated @@ -3177,6 +3159,7 @@ components: # explode: false schemas: + $ref: "openflow.openapi.yaml#/components/schemas" Script: type: object properties: @@ -3304,9 +3287,9 @@ components: The user (u/userfoo) or group (g/groupfoo) whom the execution of this script will be permissioned_as and by extension its DT_TOKEN. flow_status: - $ref: "#/components/schemas/FlowStatus" + $ref: "openflow.openapi.yaml#/components/schemas/FlowStatus" raw_flow: - $ref: "#/components/schemas/FlowValue" + $ref: "openflow.openapi.yaml#/components/schemas/FlowValue" is_flow_step: type: boolean language: @@ -3382,9 +3365,9 @@ components: The user (u/userfoo) or group (g/groupfoo) whom the execution of this script will be permissioned_as and by extension its DT_TOKEN. flow_status: - $ref: "#/components/schemas/FlowStatus" + $ref: "openflow.openapi.yaml#/components/schemas/FlowStatus" raw_flow: - $ref: "#/components/schemas/FlowValue" + $ref: "openflow.openapi.yaml#/components/schemas/FlowValue" is_flow_step: type: boolean language: @@ -3987,18 +3970,17 @@ components: - verified Flow: + allOf: + - $ref: "openflow.openapi.yaml#/components/schemas/OpenFlow" + - $ref: "#/components/schemas/FlowMetadata" + + FlowMetadata: type: object properties: workspace_id: type: string path: type: string - summary: - type: string - description: - type: string - value: - $ref: "#/components/schemas/FlowValue" edited_by: type: string edited_at: @@ -4006,112 +3988,22 @@ components: format: date-time archived: type: boolean - schema: - type: object extra_perms: type: object - additionalProperties: - type: boolean + additionalProperties: + type: boolean required: - path - - summary - - value - edited_by - edited_at - archived - extra_perms - OpenFlow: - type: object - properties: - summary: - type: string - description: - type: string - value: - $ref: "#/components/schemas/FlowValue" - schema: - type: object - required: - - summary - - value - - FlowValue: - type: object - properties: - modules: - type: array - items: - $ref: "#/components/schemas/FlowModule" - failure_module: - $ref: "#/components/schemas/FlowModule" - required: - - modules - - FlowModule: - type: object - properties: - input_transform: - type: object - additionalProperties: - $ref: "#/components/schemas/InputTransform" - value: - $ref: "#/components/schemas/FlowModuleValue" - stop_after_if_expr: - type: string - skip_if_stopped: - type: boolean - required: - - input_transform - - value - - InputTransform: - type: object - properties: - type: - type: string - enum: - - static - - javascript - step: - type: number - value: {} - expr: - type: string - - FlowModuleValue: - type: object - properties: - value: - $ref: "#/components/schemas/FlowValue" - iterator: - $ref: "#/components/schemas/InputTransform" - skip_failures: - type: boolean - path: - type: string - content: - type: string - language: - type: string - enum: - - deno - - python3 - type: - type: string - enum: - - script - - flow - - rawscript - - forloopflow - required: - - type - FlowPreview: type: object properties: value: - $ref: "#/components/schemas/FlowValue" + $ref: "openflow.openapi.yaml#/components/schemas/FlowValue" path: type: string args: @@ -4122,54 +4014,6 @@ components: - content - args - FlowStatus: - type: object - properties: - step: - type: integer - modules: - type: array - items: - $ref: "#/components/schemas/FlowStatusModule" - failure_module: - $ref: "#/components/schemas/FlowStatusModule" - required: - - step - - modules - - failure_module - - FlowStatusModule: - type: object - properties: - type: - type: string - enum: - - WaitingForPriorSteps - - WaitingForEvent - - WaitingForExecutor - - InProgress - - Success - - Failure - job: - type: string - format: uuid - event: - type: string - iterator: - type: object - properties: - index: - type: integer - itered: - type: array - items: {} - args: {} - forloop_jobs: - type: array - items: - type: string - required: [type] - SlackToken: type: object properties: diff --git a/backend/openflow.openapi.yaml b/backend/openflow.openapi.yaml new file mode 100644 index 0000000000..73ccd11890 --- /dev/null +++ b/backend/openflow.openapi.yaml @@ -0,0 +1,153 @@ +openapi: "3.0.3" + +info: + version: 1.26.0 + title: OpenFlow Spec + contact: + name: Ruben Fiszel + email: ruben@windmill.dev + url: https://windmill.dev + + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + +externalDocs: + description: documentation portal + url: https://docs.windmill.dev + +components: + schemas: + OpenFlow: + type: object + properties: + summary: + type: string + description: + type: string + value: + $ref: "#/components/schemas/FlowValue" + schema: + type: object + required: + - summary + - value + + FlowValue: + type: object + properties: + modules: + type: array + items: + $ref: "#/components/schemas/FlowModule" + failure_module: + $ref: "#/components/schemas/FlowModule" + required: + - modules + + FlowModule: + type: object + properties: + input_transform: + type: object + additionalProperties: + $ref: "#/components/schemas/InputTransform" + value: + $ref: "#/components/schemas/FlowModuleValue" + stop_after_if_expr: + type: string + skip_if_stopped: + type: boolean + required: + - input_transform + - value + + InputTransform: + type: object + properties: + type: + type: string + enum: + - static + - javascript + step: + type: number + value: {} + expr: + type: string + + FlowModuleValue: + type: object + properties: + value: + $ref: "#/components/schemas/FlowValue" + iterator: + $ref: "#/components/schemas/InputTransform" + skip_failures: + type: boolean + path: + type: string + content: + type: string + language: + type: string + enum: + - deno + - python3 + type: + type: string + enum: + - script + - flow + - rawscript + - forloopflow + required: + - type + + FlowStatus: + type: object + properties: + step: + type: integer + modules: + type: array + items: + $ref: "#/components/schemas/FlowStatusModule" + failure_module: + $ref: "#/components/schemas/FlowStatusModule" + required: + - step + - modules + - failure_module + + FlowStatusModule: + type: object + properties: + type: + type: string + enum: + - WaitingForPriorSteps + - WaitingForEvent + - WaitingForExecutor + - InProgress + - Success + - Failure + job: + type: string + format: uuid + event: + type: string + iterator: + type: object + properties: + index: + type: integer + itered: + type: array + items: {} + args: {} + forloop_jobs: + type: array + items: + type: string + required: [type]