From ad9250d77694ab77a614df27db2b4a654f724fd0 Mon Sep 17 00:00:00 2001 From: ricardo Date: Fri, 29 Apr 2022 21:54:21 -0400 Subject: [PATCH] :zap: Allow multifile openapi spec --- packages/cli/package.json | 5 +- packages/cli/src/PublicApi/v1/openapi.yml | 785 +----------------- .../PublicApi/v1/spec/parameters/Cursor.yml | 8 + .../v1/spec/parameters/ExecutionId.yml | 6 + .../v1/spec/parameters/IncludeRole.yml | 6 + .../PublicApi/v1/spec/parameters/Limit.yml | 8 + .../v1/spec/parameters/UserIdentifier.yml | 7 + .../v1/spec/parameters/WorkflowId.yml | 6 + .../PublicApi/v1/spec/parameters/_index.yml | 12 + .../PublicApi/v1/spec/paths/ExecutionById.yml | 40 + .../PublicApi/v1/spec/paths/Executions.yml | 35 + .../src/PublicApi/v1/spec/paths/UserById.yml | 38 + .../cli/src/PublicApi/v1/spec/paths/Users.yml | 48 ++ .../PublicApi/v1/spec/paths/WorkflowById.yml | 65 ++ .../v1/spec/paths/WorkflowByIdActivate.yml | 18 + .../v1/spec/paths/WorkflowByIdDesactivate.yml | 18 + .../src/PublicApi/v1/spec/paths/Workflows.yml | 54 ++ .../PublicApi/v1/spec/responses/NotFound.yml | 5 + .../v1/spec/responses/Unauthorized.yml | 5 + .../v1/spec/responses/UserInformation.yml | 5 + .../PublicApi/v1/spec/responses/_index.yml | 6 + .../src/PublicApi/v1/spec/schemas/Error.yml | 13 + .../spec/schemas/ExecutionDetailsResponse.yml | 11 + .../v1/spec/schemas/ExecutionInformation.yml | 33 + .../v1/spec/schemas/NodeInformation.yml | 30 + .../v1/spec/schemas/RoleInformation.yml | 25 + .../v1/spec/schemas/TagInformation.yml | 16 + .../v1/spec/schemas/UserDetailsResponse.yml | 11 + .../v1/spec/schemas/UserInformation.yml | 40 + .../spec/schemas/WorkflowDetailsResponse.yml | 11 + .../v1/spec/schemas/WorkflowInformation.yml | 39 + .../schemas/WorkflowSettingInformation.yml | 23 + .../src/PublicApi/v1/spec/schemas/_index.yml | 23 + 33 files changed, 681 insertions(+), 774 deletions(-) create mode 100644 packages/cli/src/PublicApi/v1/spec/parameters/Cursor.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/parameters/ExecutionId.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/parameters/IncludeRole.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/parameters/Limit.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/parameters/UserIdentifier.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/parameters/WorkflowId.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/parameters/_index.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/paths/ExecutionById.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/paths/Executions.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/paths/UserById.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/paths/Users.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/paths/WorkflowById.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/paths/WorkflowByIdActivate.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/paths/WorkflowByIdDesactivate.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/paths/Workflows.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/responses/NotFound.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/responses/Unauthorized.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/responses/UserInformation.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/responses/_index.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/Error.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/ExecutionDetailsResponse.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/ExecutionInformation.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/NodeInformation.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/RoleInformation.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/TagInformation.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/UserDetailsResponse.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/UserInformation.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/WorkflowDetailsResponse.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/WorkflowInformation.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/WorkflowSettingInformation.yml create mode 100644 packages/cli/src/PublicApi/v1/spec/schemas/_index.yml diff --git a/packages/cli/package.json b/packages/cli/package.json index fae3a33ab9..af3d7b9c1d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -19,7 +19,9 @@ "bin": "n8n" }, "scripts": { - "build": "tsc && cp -r ./src/UserManagement/email/templates ./dist/src/UserManagement/email; rsync -a --include='*/' --include={'*.yml','*.css'} --exclude='*' ./src/PublicApi/ ./dist/src/PublicApi/", + "build": "tsc; npm run build:emailTemplates; npm run build:openapi", + "build:emailTemplates": "cp -r ./src/UserManagement/email/templates ./dist/src/UserManagement/email", + "build:openapi": "rsync -a --include='*/' --include={'*.yml','swaggerTheme.css'} --exclude='*' ./src/PublicApi/ ./dist/src/PublicApi/; find ./dist/src/PublicApi/ -iname 'openapi.yml' -exec swagger-cli bundle {} --type yaml --outfile {} \\;", "dev": "concurrently -k -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold\" \"npm run watch\" \"nodemon\"", "format": "cd ../.. && node_modules/prettier/bin-prettier.js packages/cli/**/**.ts --write", "lint": "cd ../.. && node_modules/eslint/bin/eslint.js packages/cli", @@ -145,6 +147,7 @@ "request-promise-native": "^1.0.7", "sqlite3": "^5.0.2", "sse-channel": "^3.1.1", + "swagger-cli": "^4.0.4", "swagger-ui-express": "^4.3.0", "tslib": "1.14.1", "typeorm": "0.2.30", diff --git a/packages/cli/src/PublicApi/v1/openapi.yml b/packages/cli/src/PublicApi/v1/openapi.yml index b4c76b9c04..2ae1d74140 100644 --- a/packages/cli/src/PublicApi/v1/openapi.yml +++ b/packages/cli/src/PublicApi/v1/openapi.yml @@ -24,789 +24,28 @@ tags: description: Operations about workflow paths: /users: - post: - x-eov-operation-id: createUsers - x-eov-operation-handler: v1/handlers/users - tags: - - User - summary: Invite a user - description: Invites a user to your instance. Only available for the instance owner. - operationId: createUser - requestBody: - description: Created user object. - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/UserInformation' - required: true - responses: - "200": - description: A User object - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/UserInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - - get: - x-eov-operation-id: getUsers - x-eov-operation-handler: v1/handlers/users - tags: - - User - summary: Retrieve all users - description: Retrieve all users from your instance. Only available for the instance owner. - parameters: - - name: limit - in: query - description: The maximum number of items to return. - required: false - schema: - type: number - example: 100 - default: 100 - - name: cursor - in: query - description: Paginate through users by setting the cursor parameter to a nextCursor attribute returned by a previous request's response. Default value fetches the first "page" of the collection. See pagination for more detail. - required: false - style: form - schema: - type: string - example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA - - name: includeRole - in: query - required: false - style: form - description: Whether to include the role information the user object. - schema: - type: boolean - example: false - default: false - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/UserDetailsResponse' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: './spec/paths/Users.yml' /users/{identifier}: - get: - x-eov-operation-id: getUser - x-eov-operation-handler: v1/handlers/users - tags: - - User - summary: Get user by ID/Email - description: Retrieve a user from your instance. Only available for the instance owner. - operationId: getUser - parameters: - - name: identifier - in: path - description: The ID or email of the user. - required: true - schema: - type: string - format: identifier - - name: includeRole - in: query - required: false - schema: - type: boolean - example: true - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/UserInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - delete: - x-eov-operation-id: deleteUser - x-eov-operation-handler: v1/handlers/users - tags: - - User - summary: Delete user by ID/Email - description: Deletes a user from your instance. Only available for the instance owner. - operationId: deleteUser - parameters: - - name: identifier - in: path - description: The ID if the user to be deleted. - required: true - schema: - type: string - format: identifier - - name: transferId - in: query - description: ID of the user to transfer workflows and credentials to. Must not be equal to the to-be-deleted user. - required: false - schema: - type: string - - name: includeRole - in: query - required: false - schema: - type: boolean - example: true - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/UserInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - "404": - description: User not found + $ref: './spec/paths/UserById.yml' /executions: - get: - x-eov-operation-id: getExecutions - x-eov-operation-handler: v1/handlers/executions - tags: - - Execution - summary: Retrieve all executions - description: Retrieve all executions from your instance. - parameters: - - name: status - in: query - description: Status to filter the executions by. - required: false - schema: - type: string - enum: ['error', 'running', 'success', 'waiting'] - - name: workflowId - in: query - description: Workflow to filter the executions by. - required: false - schema: - type: number - example: 1000 - - name: limit - in: query - description: The maximum number of items to return. - required: false - schema: - type: number - example: 100 - default: 100 - - name: cursor - in: query - description: Paginate through executions by setting the cursor parameter to a nextCursor attribute returned by a previous request's response. Default value fetches the first "page" of the collection. See pagination for more detail. - required: false - style: form - schema: - type: string - example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/ExecutionDetailsResponse' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - "404": - description: User not found + $ref: './spec/paths/Executions.yml' /executions/{executionId}: - get: - x-eov-operation-id: getExecution - x-eov-operation-handler: v1/handlers/executions - tags: - - Execution - summary: Retrieve an execution - description: Retrieve an execution from you instance. - parameters: - - name: executionId - in: path - description: The ID of the execution. - required: true - schema: - type: number - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/ExecutionInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - "404": - description: User not found - delete: - x-eov-operation-id: deleteExecution - x-eov-operation-handler: v1/handlers/executions - tags: - - Execution - summary: Delete an execution - description: Deletes an execution from your instance. - parameters: - - name: executionId - in: path - description: The ID of the execution to be deleted. - required: true - schema: - type: number - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/ExecutionInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - "404": - description: User not found + $ref: './spec/paths/ExecutionById.yml' /workflows: - post: - x-eov-operation-id: createWorkflow - x-eov-operation-handler: v1/handlers/workflows - tags: - - Workflow - summary: Create a workflow - description: Create a workflow in your instance. - requestBody: - description: Created user object. - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowInformation' - required: true - responses: - "200": - description: A User object - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - get: - x-eov-operation-id: getWorkflows - x-eov-operation-handler: v1/handlers/workflows - tags: - - Workflow - summary: Retrieve all workflows - description: Retrieve all workflows from your instance. - parameters: - - name: active - in: query - schema: - type: boolean - example: true - - name: tags - in: query - required: false - explode: false - schema: - type: string - example: test,production - - name: limit - in: query - description: The maximum number of items to return. - required: false - schema: - type: number - example: 100 - default: 100 - - name: cursor - in: query - description: Paginate through workflows by setting the cursor parameter to a nextCursor attribute returned by a previous request's response. Default value fetches the first "page" of the collection. See pagination for more detail. - required: false - style: form - schema: - type: string - example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowDetailsResponse' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - "404": - description: User not found + $ref: './spec/paths/Workflows.yml' /workflows/{workflowId}: - get: - x-eov-operation-id: getWorkflow - x-eov-operation-handler: v1/handlers/workflows - tags: - - Workflow - summary: Retrive all workflows - description: Retrieve all workflows from your instance. - parameters: - - name: workflowId - in: path - description: The ID of the workflow. - required: true - schema: - type: number - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - "404": - description: User not found - delete: - x-eov-operation-id: deleteWorkflow - x-eov-operation-handler: v1/handlers/workflows - tags: - - Workflow - summary: Delete a workflow - description: Deletes a workflow from your instance. - parameters: - - name: workflowId - in: path - description: The ID of the workflow to be deleted. - required: true - schema: - type: number - responses: - "200": - description: Operation successful. - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - "404": - description: User not found - put: - x-eov-operation-id: updateWorkflow - x-eov-operation-handler: v1/handlers/workflows - tags: - - Workflow - summary: Update a workflow - description: Update a workflow. - parameters: - - name: workflowId - in: path - description: The ID of the workflow. - required: true - schema: - type: number - requestBody: - description: Updated workflow object. - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowInformation' - required: true - responses: - "200": - description: Workflow object - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: './spec/paths/WorkflowById.yml' /workflows/{workflowId}/activate: - post: - x-eov-operation-id: activateWorkflow - x-eov-operation-handler: v1/handlers/workflows - tags: - - Workflow - summary: Activate a workflow - description: Active a workflow. - parameters: - - name: workflowId - in: path - description: The ID of the workflow. - required: true - schema: - type: number - responses: - "200": - description: Workflow object - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: './spec/paths/WorkflowByIdActivate.yml' /workflows/{workflowId}/desactivate: - post: - x-eov-operation-id: desactivateWorkflow - x-eov-operation-handler: v1/handlers/workflows - tags: - - Workflow - summary: Desactivate a workflow - description: Desactivate a workflow. - parameters: - - name: workflowId - in: path - description: The ID of the workflow. - required: true - schema: - type: number - responses: - "200": - description: Workflow object - content: - application/json: - schema: - $ref: '#/components/schemas/WorkflowInformation' - "401": - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: './spec/paths/WorkflowByIdDesactivate.yml' components: schemas: - Error: - required: - - code - - description - - message - type: object - properties: - code: - type: string - message: - type: string - description: - type: string - UserInformation: - required: - - email - type: object - properties: - id: - type: string - readOnly: true - example: 123e4567-e89b-12d3-a456-426614174000 - email: - type: string - format: email - example: john.doe@company.com - firstName: - maxLength: 32 - type: string - description: User's first name - readOnly: true - example: john - lastName: - maxLength: 32 - type: string - description: User's last name - readOnly: true - example: Doe - isPending: - type: boolean - description: Whether the user finished setting up their account in response to the invitation (true) or not (false). - readOnly: true - createdAt: - type: string - description: Time the user was created. - format: date-time - readOnly: true - updatedAt: - type: string - description: Last time the user was updated. - format: date-time - readOnly: true - globalRole: - $ref: '#/components/schemas/RoleInformation' - ExecutionDetailsResponse: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/ExecutionInformation' - nextCursor: - type: string - description: Paginate through executions by setting the cursor parameter to a nextCursor attribute returned by a previous request. Default value fetches the first "page" of the collection. - nullable: true - example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA - UserDetailsResponse: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/UserInformation' - nextCursor: - type: string - description: Paginate through users by setting the cursor parameter to a nextCursor attribute returned by a previous request. Default value fetches the first "page" of the collection. - nullable: true - example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA - WorkflowDetailsResponse: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/WorkflowInformation' - nextCursor: - type: string - description: Paginate through workflows by setting the cursor parameter to a nextCursor attribute returned by a previous request. Default value fetches the first "page" of the collection. - nullable: true - example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA - ExecutionInformation: - type: object - properties: - id: - type: number - example: 1000 - data: - type: string - finished: - type: boolean - example: true - mode: - type: string - enum: ['cli', 'error', 'integrated', 'internal', 'manual', 'retry', 'trigger', 'webhook'] - retryOf: - type: string - nullable: true - retrySuccessId: - type: string - nullable: true - example: 2 - startedAt: - type: string - format: date-time - stoppedAt: - type: string - format: date-time - workflowId: - type: string - example: 1000 - waitTill: - type: string - nullable: true - format: date-time - RoleInformation: - readOnly: true - type: object - properties: - id: - type: number - readOnly: true - example: 1 - name: - type: string - example: owner - readOnly: true - scope: - type: string - readOnly: true - example: global - createdAt: - type: string - description: Time the role was created. - format: date-time - readOnly: true - updatedAt: - type: string - description: Last time the role was updaded. - format: date-time - readOnly: true - TagInformation: - type: object - properties: - id: - type: string - example: 12 - name: - type: string - example: Production - createdAt: - type: string - format: date-time - readOnly: true - updatedAt: - type: string - format: date-time - readOnly: true - NodeInformation: - type: object - properties: - name: - type: string - example: Jira - type: - type: string - example: n8n-nodes-base.Jira - typeVersion: - type: number - example: 1 - position: - type: array - items: - type: number - example: [-100, 80] - parameters: - type: object - example: { additionalProperties: {} } - credentials: - type: object - example: { jiraSoftwareCloudApi: { id: "35", name: "jiraApi"} } - createdAt: - type: string - format: date-time - readOnly: true - updatedAt: - type: string - format: date-time - readOnly: true - WorkflowSettingInformation: - type: object - properties: - saveExecutionProgress: - type: boolean - saveManualExecutions: - type: boolean - saveDataErrorExecution: - type: string - enum: ['all', 'none'] - saveDataSuccessExecution: - type: string - enum: ['all', 'none'] - executionTimeout: - type: number - example: 3600 - maxLength: 3600 - errorWorkflow: - type: string - example: 10 - description: The ID of the workflow that contains the error trigger node. - timezone: - type: string - example: America/New_York - WorkflowInformation: - type: object - properties: - id: - type: number - readOnly: true - example: 1 - name: - type: string - example: Workflow 1 - active: - type: boolean - readOnly: true - createdAt: - type: string - format: date-time - readOnly: true - updatedAt: - type: string - format: date-time - readOnly: true - nodes: - type: array - items: - $ref: '#/components/schemas/NodeInformation' - connections: - type: object - example: { main: [{node: "Jira", type: "main", index: 0}] } - settings: - $ref: '#/components/schemas/WorkflowSettingInformation' - staticData: - type: string - nullable: true - readOnly: true - example: "{ iterationId: 2 }" - tags: - type: array - items: - $ref: '#/components/schemas/TagInformation' - readOnly: true - + $ref: './spec/schemas/_index.yml' responses: - NotFound: - description: The specified resource was not found. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - Unauthorized: - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - Forbidden: - description: Forbidden - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: './spec/responses/_index.yml' + parameters: + $ref: './spec/parameters/_index.yml' securitySchemes: ApiKeyAuth: type: apiKey diff --git a/packages/cli/src/PublicApi/v1/spec/parameters/Cursor.yml b/packages/cli/src/PublicApi/v1/spec/parameters/Cursor.yml new file mode 100644 index 0000000000..6ecee3ae44 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/parameters/Cursor.yml @@ -0,0 +1,8 @@ +name: cursor +in: query +description: Paginate through users by setting the cursor parameter to a nextCursor attribute returned by a previous request's response. Default value fetches the first "page" of the collection. See pagination for more detail. +required: false +style: form +schema: + type: string + example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA diff --git a/packages/cli/src/PublicApi/v1/spec/parameters/ExecutionId.yml b/packages/cli/src/PublicApi/v1/spec/parameters/ExecutionId.yml new file mode 100644 index 0000000000..d7248df7be --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/parameters/ExecutionId.yml @@ -0,0 +1,6 @@ +name: executionId +in: path +description: The ID of the execution. +required: true +schema: + type: number diff --git a/packages/cli/src/PublicApi/v1/spec/parameters/IncludeRole.yml b/packages/cli/src/PublicApi/v1/spec/parameters/IncludeRole.yml new file mode 100644 index 0000000000..e372805430 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/parameters/IncludeRole.yml @@ -0,0 +1,6 @@ +name: includeRole +in: query +required: false +schema: + type: boolean + example: true diff --git a/packages/cli/src/PublicApi/v1/spec/parameters/Limit.yml b/packages/cli/src/PublicApi/v1/spec/parameters/Limit.yml new file mode 100644 index 0000000000..2357af499d --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/parameters/Limit.yml @@ -0,0 +1,8 @@ +name: limit +in: query +description: The maximum number of items to return. +required: false +schema: + type: number + example: 100 + default: 100 diff --git a/packages/cli/src/PublicApi/v1/spec/parameters/UserIdentifier.yml b/packages/cli/src/PublicApi/v1/spec/parameters/UserIdentifier.yml new file mode 100644 index 0000000000..a1c55a3ef1 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/parameters/UserIdentifier.yml @@ -0,0 +1,7 @@ + name: identifier + in: path + description: The ID or email of the user. + required: true + schema: + type: string + format: identifier diff --git a/packages/cli/src/PublicApi/v1/spec/parameters/WorkflowId.yml b/packages/cli/src/PublicApi/v1/spec/parameters/WorkflowId.yml new file mode 100644 index 0000000000..6a3ec22919 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/parameters/WorkflowId.yml @@ -0,0 +1,6 @@ + name: workflowId + in: path + description: The ID of the workflow. + required: true + schema: + type: number diff --git a/packages/cli/src/PublicApi/v1/spec/parameters/_index.yml b/packages/cli/src/PublicApi/v1/spec/parameters/_index.yml new file mode 100644 index 0000000000..3daec8fcce --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/parameters/_index.yml @@ -0,0 +1,12 @@ +UserIdentifier: + $ref: './UserIdentifier.yml' +Cursor: + $ref: './Cursor.yml' +includeRole: + $ref: './IncludeRole.yml' +Limit: + $ref: './Limit.yml' +ExecutionId: + $ref: './ExecutionId.yml' +WorkflowId: + $ref: './WorkflowId.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/paths/ExecutionById.yml b/packages/cli/src/PublicApi/v1/spec/paths/ExecutionById.yml new file mode 100644 index 0000000000..a7cb6ddb8f --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/paths/ExecutionById.yml @@ -0,0 +1,40 @@ +get: + x-eov-operation-id: getExecution + x-eov-operation-handler: v1/handlers/executions + tags: + - Execution + summary: Retrieve an execution + description: Retrieve an execution from you instance. + parameters: + - $ref: '../parameters/ExecutionId.yml' + responses: + '200': + description: Operation successful. + content: + application/json: + schema: + $ref: '../schemas/ExecutionInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' + '404': + $ref: '../responses/NotFound.yml' +delete: + x-eov-operation-id: deleteExecution + x-eov-operation-handler: v1/handlers/executions + tags: + - Execution + summary: Delete an execution + description: Deletes an execution from your instance. + parameters: + - $ref: '../parameters/ExecutionId.yml' + responses: + '200': + description: Operation successful. + content: + application/json: + schema: + $ref: '../schemas/ExecutionInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' + '404': + $ref: '../responses/NotFound.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/paths/Executions.yml b/packages/cli/src/PublicApi/v1/spec/paths/Executions.yml new file mode 100644 index 0000000000..b6f58b5b7c --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/paths/Executions.yml @@ -0,0 +1,35 @@ +get: + x-eov-operation-id: getExecutions + x-eov-operation-handler: v1/handlers/executions + tags: + - Execution + summary: Retrieve all executions + description: Retrieve all executions from your instance. + parameters: + - name: status + in: query + description: Status to filter the executions by. + required: false + schema: + type: string + enum: ['error', 'running', 'success', 'waiting'] + - name: workflowId + in: query + description: Workflow to filter the executions by. + required: false + schema: + type: number + example: 1000 + - $ref: '../parameters/Limit.yml' + - $ref: '../parameters/Cursor.yml' + responses: + '200': + description: Operation successful. + content: + application/json: + schema: + $ref: '../schemas/ExecutionDetailsResponse.yml' + "401": + $ref: '../responses/Unauthorized.yml' + '404': + $ref: '../responses/NotFound.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/paths/UserById.yml b/packages/cli/src/PublicApi/v1/spec/paths/UserById.yml new file mode 100644 index 0000000000..7662685775 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/paths/UserById.yml @@ -0,0 +1,38 @@ +get: + x-eov-operation-id: getUser + x-eov-operation-handler: v1/handlers/users + tags: + - User + summary: Get user by ID/Email + description: Retrieve a user from your instance. Only available for the instance owner. + parameters: + - $ref: '../parameters/UserIdentifier.yml' + - $ref: '../parameters/IncludeRole.yml' + responses: + '200': + $ref: '../responses/UserInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' +delete: + x-eov-operation-id: deleteUser + x-eov-operation-handler: v1/handlers/users + tags: + - User + summary: Delete user by ID/Email + description: Deletes a user from your instance. Only available for the instance owner. + operationId: deleteUser + parameters: + - $ref: '../parameters/UserIdentifier.yml' + - $ref: '../parameters/IncludeRole.yml' + - name: transferId + in: query + description: ID of the user to transfer workflows and credentials to. Must not be equal to the to-be-deleted user. + required: false + schema: + type: string + responses: + '200': + $ref: '../responses/UserInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' + diff --git a/packages/cli/src/PublicApi/v1/spec/paths/Users.yml b/packages/cli/src/PublicApi/v1/spec/paths/Users.yml new file mode 100644 index 0000000000..1fa6bcdf6c --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/paths/Users.yml @@ -0,0 +1,48 @@ +post: + x-eov-operation-id: createUsers + x-eov-operation-handler: v1/handlers/users + tags: + - User + summary: Invite a user + description: Invites a user to your instance. Only available for the instance owner. + operationId: createUser + requestBody: + description: Created user object. + content: + application/json: + schema: + type: array + items: + $ref: '../schemas/UserInformation.yml' + required: true + responses: + '200': + description: A User object + content: + application/json: + schema: + type: array + items: + $ref: '../schemas/UserInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' +get: + x-eov-operation-id: getUsers + x-eov-operation-handler: v1/handlers/users + tags: + - User + summary: Retrieve all users + description: Retrieve all users from your instance. Only available for the instance owner. + parameters: + - $ref: '../parameters/Limit.yml' + - $ref: '../parameters/Cursor.yml' + - $ref: '../parameters/IncludeRole.yml' + responses: + '200': + description: Operation successful. + content: + application/json: + schema: + $ref: '../schemas/UserDetailsResponse.yml' + '401': + $ref: '../responses/Unauthorized.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/paths/WorkflowById.yml b/packages/cli/src/PublicApi/v1/spec/paths/WorkflowById.yml new file mode 100644 index 0000000000..04210deb38 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/paths/WorkflowById.yml @@ -0,0 +1,65 @@ +get: + x-eov-operation-id: getWorkflow + x-eov-operation-handler: v1/handlers/workflows + tags: + - Workflow + summary: Retrive all workflows + description: Retrieve all workflows from your instance. + parameters: + - $ref: '../parameters/WorkflowId.yml' + responses: + '200': + description: Operation successful. + content: + application/json: + schema: + $ref: '../schemas/WorkflowInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' + '404': + $ref: '../responses/NotFound.yml' +delete: + x-eov-operation-id: deleteWorkflow + x-eov-operation-handler: v1/handlers/workflows + tags: + - Workflow + summary: Delete a workflow + description: Deletes a workflow from your instance. + parameters: + - $ref: '../parameters/WorkflowId.yml' + responses: + '200': + description: Operation successful. + content: + application/json: + schema: + $ref: '../schemas/WorkflowInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' + '404': + $ref: '../responses/NotFound.yml' +put: + x-eov-operation-id: updateWorkflow + x-eov-operation-handler: v1/handlers/workflows + tags: + - Workflow + summary: Update a workflow + description: Update a workflow. + parameters: + - $ref: '../parameters/WorkflowId.yml' + requestBody: + description: Updated workflow object. + content: + application/json: + schema: + $ref: '../schemas/WorkflowInformation.yml' + required: true + responses: + '200': + description: Workflow object + content: + application/json: + schema: + $ref: '../schemas/WorkflowInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/paths/WorkflowByIdActivate.yml b/packages/cli/src/PublicApi/v1/spec/paths/WorkflowByIdActivate.yml new file mode 100644 index 0000000000..c166c2727e --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/paths/WorkflowByIdActivate.yml @@ -0,0 +1,18 @@ +post: + x-eov-operation-id: activateWorkflow + x-eov-operation-handler: v1/handlers/workflows + tags: + - Workflow + summary: Activate a workflow + description: Active a workflow. + parameters: + - $ref: '../parameters/WorkflowId.yml' + responses: + '200': + description: Workflow object + content: + application/json: + schema: + $ref: '../schemas/WorkflowInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/paths/WorkflowByIdDesactivate.yml b/packages/cli/src/PublicApi/v1/spec/paths/WorkflowByIdDesactivate.yml new file mode 100644 index 0000000000..653db62aa7 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/paths/WorkflowByIdDesactivate.yml @@ -0,0 +1,18 @@ +post: + x-eov-operation-id: desactivateWorkflow + x-eov-operation-handler: v1/handlers/workflows + tags: + - Workflow + summary: Desactivate a workflow + description: Desactivate a workflow. + parameters: + - $ref: '../parameters/WorkflowId.yml' + responses: + '200': + description: Workflow object + content: + application/json: + schema: + $ref: '../schemas/WorkflowInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/paths/Workflows.yml b/packages/cli/src/PublicApi/v1/spec/paths/Workflows.yml new file mode 100644 index 0000000000..5301e6f8a7 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/paths/Workflows.yml @@ -0,0 +1,54 @@ +post: + x-eov-operation-id: createWorkflow + x-eov-operation-handler: v1/handlers/workflows + tags: + - Workflow + summary: Create a workflow + description: Create a workflow in your instance. + requestBody: + description: Created user object. + content: + application/json: + schema: + $ref: '../schemas/WorkflowInformation.yml' + required: true + responses: + '200': + description: A User object + content: + application/json: + schema: + $ref: '../schemas/WorkflowInformation.yml' + '401': + $ref: '../responses/Unauthorized.yml' +get: + x-eov-operation-id: getWorkflows + x-eov-operation-handler: v1/handlers/workflows + tags: + - Workflow + summary: Retrieve all workflows + description: Retrieve all workflows from your instance. + parameters: + - name: active + in: query + schema: + type: boolean + example: true + - name: tags + in: query + required: false + explode: false + schema: + type: string + example: test,production + - $ref: '../parameters/Limit.yml' + - $ref: '../parameters/Cursor.yml' + responses: + '200': + description: Operation successful. + content: + application/json: + schema: + $ref: '../schemas/WorkflowDetailsResponse.yml' + '401': + $ref: '../responses/Unauthorized.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/responses/NotFound.yml b/packages/cli/src/PublicApi/v1/spec/responses/NotFound.yml new file mode 100644 index 0000000000..66f2b0cc8d --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/responses/NotFound.yml @@ -0,0 +1,5 @@ +description: The specified resource was not found. +content: + application/json: + schema: + $ref: '../schemas/Error.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/responses/Unauthorized.yml b/packages/cli/src/PublicApi/v1/spec/responses/Unauthorized.yml new file mode 100644 index 0000000000..ed74758706 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/responses/Unauthorized.yml @@ -0,0 +1,5 @@ +description: Unauthorized +content: + application/json: + schema: + $ref: '../schemas/Error.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/responses/UserInformation.yml b/packages/cli/src/PublicApi/v1/spec/responses/UserInformation.yml new file mode 100644 index 0000000000..3780cf2fbb --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/responses/UserInformation.yml @@ -0,0 +1,5 @@ +description: Operation successful. +content: + application/json: + schema: + $ref: '../schemas/UserInformation.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/responses/_index.yml b/packages/cli/src/PublicApi/v1/spec/responses/_index.yml new file mode 100644 index 0000000000..eaee166e23 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/responses/_index.yml @@ -0,0 +1,6 @@ +NotFound: + $ref: './NotFound.yml' +Unauthorized: + $ref: './Unauthorized.yml' +UserInformation: + $ref: './UserInformation.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/Error.yml b/packages/cli/src/PublicApi/v1/spec/schemas/Error.yml new file mode 100644 index 0000000000..f32e8faf4c --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/Error.yml @@ -0,0 +1,13 @@ + #error.yml + required: + - code + - description + - message + type: object + properties: + code: + type: string + message: + type: string + description: + type: string diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/ExecutionDetailsResponse.yml b/packages/cli/src/PublicApi/v1/spec/schemas/ExecutionDetailsResponse.yml new file mode 100644 index 0000000000..657be0de66 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/ExecutionDetailsResponse.yml @@ -0,0 +1,11 @@ +type: object +properties: + data: + type: array + items: + $ref: './ExecutionInformation.yml' + nextCursor: + type: string + description: Paginate through executions by setting the cursor parameter to a nextCursor attribute returned by a previous request. Default value fetches the first "page" of the collection. + nullable: true + example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/ExecutionInformation.yml b/packages/cli/src/PublicApi/v1/spec/schemas/ExecutionInformation.yml new file mode 100644 index 0000000000..80b7415e5e --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/ExecutionInformation.yml @@ -0,0 +1,33 @@ +type: object +properties: + id: + type: number + example: 1000 + data: + type: string + finished: + type: boolean + example: true + mode: + type: string + enum: ['cli', 'error', 'integrated', 'internal', 'manual', 'retry', 'trigger', 'webhook'] + retryOf: + type: string + nullable: true + retrySuccessId: + type: string + nullable: true + example: 2 + startedAt: + type: string + format: date-time + stoppedAt: + type: string + format: date-time + workflowId: + type: string + example: 1000 + waitTill: + type: string + nullable: true + format: date-time diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/NodeInformation.yml b/packages/cli/src/PublicApi/v1/spec/schemas/NodeInformation.yml new file mode 100644 index 0000000000..b92e119596 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/NodeInformation.yml @@ -0,0 +1,30 @@ +type: object +properties: + name: + type: string + example: Jira + type: + type: string + example: n8n-nodes-base.Jira + typeVersion: + type: number + example: 1 + position: + type: array + items: + type: number + example: [-100, 80] + parameters: + type: object + example: { additionalProperties: {} } + credentials: + type: object + example: { jiraSoftwareCloudApi: { id: "35", name: "jiraApi"} } + createdAt: + type: string + format: date-time + readOnly: true + updatedAt: + type: string + format: date-time + readOnly: true diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/RoleInformation.yml b/packages/cli/src/PublicApi/v1/spec/schemas/RoleInformation.yml new file mode 100644 index 0000000000..7043fb460f --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/RoleInformation.yml @@ -0,0 +1,25 @@ +readOnly: true +type: object +properties: + id: + type: number + readOnly: true + example: 1 + name: + type: string + example: owner + readOnly: true + scope: + type: string + readOnly: true + example: global + createdAt: + type: string + description: Time the role was created. + format: date-time + readOnly: true + updatedAt: + type: string + description: Last time the role was updaded. + format: date-time + readOnly: true diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/TagInformation.yml b/packages/cli/src/PublicApi/v1/spec/schemas/TagInformation.yml new file mode 100644 index 0000000000..ff5b571504 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/TagInformation.yml @@ -0,0 +1,16 @@ +type: object +properties: + id: + type: string + example: 12 + name: + type: string + example: Production + createdAt: + type: string + format: date-time + readOnly: true + updatedAt: + type: string + format: date-time + readOnly: true diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/UserDetailsResponse.yml b/packages/cli/src/PublicApi/v1/spec/schemas/UserDetailsResponse.yml new file mode 100644 index 0000000000..6578deac5f --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/UserDetailsResponse.yml @@ -0,0 +1,11 @@ +type: object +properties: + data: + type: array + items: + $ref: './UserInformation.yml' + nextCursor: + type: string + description: Paginate through users by setting the cursor parameter to a nextCursor attribute returned by a previous request. Default value fetches the first "page" of the collection. + nullable: true + example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/UserInformation.yml b/packages/cli/src/PublicApi/v1/spec/schemas/UserInformation.yml new file mode 100644 index 0000000000..3dedbefd6a --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/UserInformation.yml @@ -0,0 +1,40 @@ +required: +- email +type: object +properties: + id: + type: string + readOnly: true + example: 123e4567-e89b-12d3-a456-426614174000 + email: + type: string + format: email + example: john.doe@company.com + firstName: + maxLength: 32 + type: string + description: User's first name + readOnly: true + example: john + lastName: + maxLength: 32 + type: string + description: User's last name + readOnly: true + example: Doe + isPending: + type: boolean + description: Whether the user finished setting up their account in response to the invitation (true) or not (false). + readOnly: true + createdAt: + type: string + description: Time the user was created. + format: date-time + readOnly: true + updatedAt: + type: string + description: Last time the user was updated. + format: date-time + readOnly: true + globalRole: + $ref: './RoleInformation.yml' diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowDetailsResponse.yml b/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowDetailsResponse.yml new file mode 100644 index 0000000000..211c83c6b8 --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowDetailsResponse.yml @@ -0,0 +1,11 @@ +type: object +properties: + data: + type: array + items: + $ref: './WorkflowInformation.yml' + nextCursor: + type: string + description: Paginate through workflows by setting the cursor parameter to a nextCursor attribute returned by a previous request. Default value fetches the first "page" of the collection. + nullable: true + example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowInformation.yml b/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowInformation.yml new file mode 100644 index 0000000000..b6b89adbbe --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowInformation.yml @@ -0,0 +1,39 @@ +type: object +properties: + id: + type: number + readOnly: true + example: 1 + name: + type: string + example: Workflow 1 + active: + type: boolean + readOnly: true + createdAt: + type: string + format: date-time + readOnly: true + updatedAt: + type: string + format: date-time + readOnly: true + nodes: + type: array + items: + $ref: './NodeInformation.yml' + connections: + type: object + example: { main: [{node: "Jira", type: "main", index: 0}] } + settings: + $ref: './WorkflowSettingInformation.yml' + staticData: + type: string + nullable: true + readOnly: true + example: "{ iterationId: 2 }" + tags: + type: array + items: + $ref: './TagInformation.yml' + readOnly: true diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowSettingInformation.yml b/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowSettingInformation.yml new file mode 100644 index 0000000000..9500db261b --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/WorkflowSettingInformation.yml @@ -0,0 +1,23 @@ +type: object +properties: + saveExecutionProgress: + type: boolean + saveManualExecutions: + type: boolean + saveDataErrorExecution: + type: string + enum: ['all', 'none'] + saveDataSuccessExecution: + type: string + enum: ['all', 'none'] + executionTimeout: + type: number + example: 3600 + maxLength: 3600 + errorWorkflow: + type: string + example: 10 + description: The ID of the workflow that contains the error trigger node. + timezone: + type: string + example: America/New_York diff --git a/packages/cli/src/PublicApi/v1/spec/schemas/_index.yml b/packages/cli/src/PublicApi/v1/spec/schemas/_index.yml new file mode 100644 index 0000000000..476f90fc5d --- /dev/null +++ b/packages/cli/src/PublicApi/v1/spec/schemas/_index.yml @@ -0,0 +1,23 @@ +Error: + $ref: './Error.yml' +ExecutionInformation: + $ref: './ExecutionInformation.yml' +NodeInformation: + $ref: './NodeInformation.yml' +RoleInformation: + $ref: './RoleInformation.yml' +TagInformation: + $ref: './TagInformation.yml' +UserInformation: + $ref: './UserInformation.yml' +WorkflowInformation: + $ref: './WorkflowInformation.yml' +WorkflowSettingInformation: + $ref: './WorkflowSettingInformation.yml' +UserDetailsResponse: + $ref: './UserDetailsResponse.yml' +ExecutionDetailsResponse: + $ref: './ExecutionDetailsResponse.yml' +WorkflowDetailsResponse: + $ref: './WorkflowDetailsResponse.yml' +