@@ -2,18 +2,41 @@ import {OpenAPIV3} from "openapi-types";
22import * as lodash from "lodash" ;
33import { OperationContext } from "./openapi/OpenAPIVisitor" ;
44
5+ /**
6+ * Extract information for n8n node from OpenAPI operation
7+ */
58export interface IOperationParser {
9+ /**
10+ * Name of the operation (e.g. "Create User")
11+ */
612 name ( operation : OpenAPIV3 . OperationObject , context : OperationContext ) : string
713
14+ /**
15+ * Value of the operation (e.g. "create-user")
16+ */
817 value ( operation : OpenAPIV3 . OperationObject , context : OperationContext ) : string
918
19+ /**
20+ * Action of the operation (e.g. "Create User") - will be visible in list of actions
21+ */
1022 action ( operation : OpenAPIV3 . OperationObject , context : OperationContext ) : string
1123
24+ /**
25+ * Description of the operation
26+ */
1227 description ( operation : OpenAPIV3 . OperationObject , context : OperationContext ) : string
1328
29+ /**
30+ * Should skip this operation or not
31+ */
1432 shouldSkip ( operation : OpenAPIV3 . OperationObject , context : OperationContext ) : boolean ;
1533}
1634
35+ /**
36+ * Default behaviour for OpenAPI to n8n operation parser
37+ * It will use operationId as name, value and action and summary as description
38+ * Skip deprecated operations
39+ */
1740export class DefaultOperationParser implements IOperationParser {
1841 shouldSkip ( operation : OpenAPIV3 . OperationObject , context : OperationContext ) : boolean {
1942 return ! ! operation . deprecated
0 commit comments