Skip to content

Commit ef70e93

Browse files
committed
docs
1 parent d36a12b commit ef70e93

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/OperationParser.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,41 @@ import {OpenAPIV3} from "openapi-types";
22
import * as lodash from "lodash";
33
import {OperationContext} from "./openapi/OpenAPIVisitor";
44

5+
/**
6+
* Extract information for n8n node from OpenAPI operation
7+
*/
58
export 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+
*/
1740
export class DefaultOperationParser implements IOperationParser {
1841
shouldSkip(operation: OpenAPIV3.OperationObject, context: OperationContext): boolean {
1942
return !!operation.deprecated

0 commit comments

Comments
 (0)