File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,14 @@ export interface N8NPropertiesBuilderConfig {
2121 resource ?: IResourceParser ,
2222}
2323
24+ /**
25+ *
26+ * Builds n8n node "properties" from an OpenAPI document.
27+ * It uses a walker to traverse the OpenAPI document and collect the necessary information.
28+ * The collected information is then used to build the n8n node properties.
29+ * The class uses a set of parsers to parse the OpenAPI document and build the n8n node properties.
30+ *
31+ */
2432export class N8NPropertiesBuilder {
2533 private readonly doc : OpenAPIV3 . Document ;
2634 private readonly logger : pino . Logger
Original file line number Diff line number Diff line change 11import { OpenAPIV3 } from "openapi-types" ;
22import * as lodash from "lodash" ;
33
4+ /**
5+ * Extract information for n8n node from OpenAPI resource
6+ */
47export interface IResourceParser {
8+ /**
9+ * Name of the resource (e.g. "User")
10+ * @param tag
11+ */
512 name ( tag : OpenAPIV3 . TagObject ) : string
613
14+ /**
15+ * Value of the resource (e.g. "user")
16+ * @note - will be used on operations as well, only "name" will be available for that
17+ */
718 value ( tag : Pick < OpenAPIV3 . TagObject , "name" > ) : string
819
20+ /**
21+ * Description of the resource
22+ * @param tag
23+ */
924 description ( tag : OpenAPIV3 . TagObject ) : string
1025}
1126
27+ /**
28+ * Default behaviour for OpenAPI to n8n resource parser
29+ * It will use tag name as name and value and description as description
30+ */
1231export class DefaultResourceParser {
1332 name ( tag : OpenAPIV3 . TagObject ) : string {
1433 return lodash . startCase ( tag . name ) ;
You can’t perform that action at this time.
0 commit comments